This Patch fixes the following two bugs in the
Intel Medfield Over Current Detector Driver,
that was submitted on meego lists, recently.
1. If the bcu_status input is neither 0 nor 1, return -EINVAL.
2. When storing timer value, if we get a -ve index, return -EINVAL.

This patch should be applied on top of the original
Patch, which can be downloaded from here:
http://lists.meego.com/pipermail/meego-kernel/2010-November/001476.html

-------------------------------------------------
From: Durgadoss R <[email protected]>

Date: Tue, 14 Dec 2010 08:45:33 +0530
Subject: [PATCH 1/1] Bug_fix_for_intel_mid_ocd.c

This patch fixes two bugs in the Medfield Over Current
Detector Driver:
1. If the bcu_status input is neither 0 nor 1, return -EINVAL.
2. When storing timer value, if we get a -ve index, return -EINVAL.

Signed-off-by: Durgadoss R <[email protected]>

---
 drivers/hwmon/intel_mid_ocd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/intel_mid_ocd.c b/drivers/hwmon/intel_mid_ocd.c
index 0e78d9c..9e502ac 100644
--- a/drivers/hwmon/intel_mid_ocd.c
+++ b/drivers/hwmon/intel_mid_ocd.c
@@ -126,6 +126,9 @@ static ssize_t store_bcu_status(struct device *dev,
        if (strict_strtoul(buf, 10, &val))
                return -EINVAL;
 
+       if (val != 0 && val != 1)
+               return -EINVAL;
+
        return configure_bcu(val) ? -EINVAL : count;
 }
 
@@ -290,7 +293,7 @@ static ssize_t store_timer_thres(struct device *dev,
 
        val = get_timer_threshold(time, s_attr->nr);
        if (val < 0)
-               ret = -EINVAL;
+               return -EINVAL;
 
        mutex_lock(&ocd_update_lock);
 
-- 
1.6.5.2


Attachment: 0001-Bug_fix_for_intel_mid_ocd.c.patch
Description: 0001-Bug_fix_for_intel_mid_ocd.c.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to