Skip to contentSkip to conversation

backlight: s6e63m0: corruption storing gamma mode

PATCH In review Dan Carpenter 2 participants 2 messages Mar 2, 2012 – Mar 5, 2012

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

PATCH 1/1 backlight: s6e63m0: corruption storing gamma mode

strict_strtoul() writes a long but ->gamma_mode only has space to store an int, so on 64 bit systems we end up scribbling over ->gamma_table_count as well. I've changed it to use kstrtouint() instead.

drivers/video/backlight/s6e63m0.c +1 -1
index 9b0092e..e264f55 100644
@@ -690,7 +690,7 @@ static ssize_t s6e63m0_sysfs_store_gamma_mode(struct device *dev,
 	struct backlight_device *bd = NULL;
 	int brightness, rc;
 
-	rc = strict_strtoul(buf, 0, (unsigned long *)&lcd->gamma_mode);
+	rc = kstrtouint(buf, 0, &lcd->gamma_mode);
 	if (rc < 0)
 		return rc;
 
Acked-by on v1 1/1
#1 lore raw

Thanks.

Quoted 35 lines

-----Original Message-----
From: [email protected] [mailto:linux-fbdev- [email protected]] On Behalf Of Dan Carpenter
Sent: Friday, March 02, 2012 3:56 PM
To: Richard Purdie; InKi Dae
Cc: Florian Tobias Schandinat; [email protected]; kernel- [email protected]
Subject: [patch] backlight: s6e63m0: corruption storing gamma mode

strict_strtoul() writes a long but ->gamma_mode only has space to store an int, so on 64 bit systems we end up scribbling over ->gamma_table_count as well. I've changed it to use kstrtouint() instead.

drivers/video/backlight/s6e63m0.c +1 -2
index 9b0092e..e264f55 100644
@@ -690,7 +690,7 @@ static ssize_t s6e63m0_sysfs_store_gamma_mode(struct
 device *dev,
 	struct backlight_device *bd = NULL;
 	int brightness, rc;
 
-	rc = strict_strtoul(buf, 0, (unsigned long *)&lcd->gamma_mode);
+	rc = kstrtouint(buf, 0, &lcd->gamma_mode);
 	if (rc < 0)
 		return rc;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html