[PATCH] leds: fix unsigned value overflow in for loop

摘自: LKML  被阅读次数: 17


由'机器人'于 2008-05-13 15:01:31 提供


DateTue, 13 May 2008 14:56:56 +0800
FromLi Zefan <>
Subject[PATCH] leds: fix unsigned value overflow in for loop
Fix the following unsigned variable overflow:
	unsigned i;
	for (i = n; i >= 0; i--)
	...

It won't break anything to use type 'int'.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 drivers/leds/leds-atmel-pwm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index 28db6c1..52297c3 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -37,7 +37,7 @@ static int __init pwmled_probe(struct platform_device *pdev)
 {
 	const struct gpio_led_platform_data	*pdata;
 	struct pwmled				*leds;
-	unsigned				i;
+	int					i;
 	int					status;
 
 	pdata = pdev->dev.platform_data;
-- 
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

原文链接: http://lkml.org/lkml/2008/5/13/42
下载该patch