[PATCH 1/4] video/backlight-pwm: fixed a loop index going out of range.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the function pwm_backlight_parse_dt() the last iteration of the for
loop accessed memory past the end of the array 'pwm_backlight->levels[]'
because of a wrong test ( '<=' instead of '<').
---
 drivers/video/backlight-pwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index 91435f8..3024ec6 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -150,7 +150,7 @@ static int pwm_backlight_parse_dt(struct device_d *dev,
 		if (ret < 0)
 			return ret;
 
-		for (i = 0; i <=  pwm_backlight->backlight.brightness_max; i++)
+		for (i = 0; i < pwm_backlight->backlight.brightness_max; i++)
 			if (pwm_backlight->levels[i] > pwm_backlight->scale)
 				pwm_backlight->scale = pwm_backlight->levels[i];
 
-- 
2.9.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux