Skip to contentSkip to conversation

mfd: off by one issue

PATCH In review Dan Carpenter 2 participants 2 messages Mar 28, 2010 – Apr 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: off by one issue

"pcf->irq_handler" has PCF50633_NUM_IRQ elements.

drivers/mfd/pcf50633-core.c +2 -2
index 03dcc92..4f13608 100644
@@ -217,7 +217,7 @@ static struct attribute_group pcf_attr_group = {
 int pcf50633_register_irq(struct pcf50633 *pcf, int irq,
 			void (*handler) (int, void *), void *data)
 {
-	if (irq < 0 || irq > PCF50633_NUM_IRQ || !handler)
+	if (irq < 0 || irq >= PCF50633_NUM_IRQ || !handler)
 		return -EINVAL;
 
 	if (WARN_ON(pcf->irq_handler[irq].handler))
@@ -234,7 +234,7 @@ EXPORT_SYMBOL_GPL(pcf50633_register_irq);
 
 int pcf50633_free_irq(struct pcf50633 *pcf, int irq)
 {
-	if (irq < 0 || irq > PCF50633_NUM_IRQ)
+	if (irq < 0 || irq >= PCF50633_NUM_IRQ)
 		return -EINVAL;
 
 	mutex_lock(&pcf->lock);
#1 lore raw

Hi Dan,

Quoted 3 lines · Dan Carpenter

"pcf->irq_handler" has PCF50633_NUM_IRQ elements.

Patch applied, many thanks.

Cheers,
Samuel.

Quoted 22 lines
drivers/mfd/pcf50633-core.c +2 -2
index 03dcc92..4f13608 100644
@@ -217,7 +217,7 @@ static struct attribute_group pcf_attr_group = {
 int pcf50633_register_irq(struct pcf50633 *pcf, int irq,
 			void (*handler) (int, void *), void *data)
 {
-	if (irq < 0 || irq > PCF50633_NUM_IRQ || !handler)
+	if (irq < 0 || irq >= PCF50633_NUM_IRQ || !handler)
 		return -EINVAL;
 
 	if (WARN_ON(pcf->irq_handler[irq].handler))
@@ -234,7 +234,7 @@ EXPORT_SYMBOL_GPL(pcf50633_register_irq);
 
 int pcf50633_free_irq(struct pcf50633 *pcf, int irq)
 {
-	if (irq < 0 || irq > PCF50633_NUM_IRQ)
+	if (irq < 0 || irq >= PCF50633_NUM_IRQ)
 		return -EINVAL;
 
 	mutex_lock(&pcf->lock);
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/