lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 19 Feb 2012 15:08:22 +0800 From: Axel Lin <axel.lin@...il.com> To: linux-kernel@...r.kernel.org Cc: Richard Purdie <rpurdie@...ys.net>, "Milo(Woogyom) Kim" <milo.kim@...com>, Andrew Morton <akpm@...ux-foundation.org> Subject: [PATCH] drivers/video/backlight/lp855x_bl.c: fix setting initial value for max_brightness and brightness Current code does not always ensure pdata->initial_brightness <= pdata->max_brightness <= MAX_BRIGHTNESS. Fix it. Signed-off-by: Axel Lin <axel.lin@...il.com> --- drivers/video/backlight/lp855x_bl.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index d32c097..29a3af2 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -24,6 +24,7 @@ #define BUF_SIZE (20) #define DEFAULT_BL_NAME "lcd-backlight" +#define MAX_BRIGHTNESS 255 struct lp855x { const char *chipid; @@ -171,10 +172,14 @@ static int lp855x_backlight_register(struct lp855x *lp) char *name = pdata->name ? : DEFAULT_BL_NAME; props.type = BACKLIGHT_PLATFORM; + + if (pdata->max_brightness > MAX_BRIGHTNESS) + pdata->max_brightness = MAX_BRIGHTNESS; + props.max_brightness = pdata->max_brightness; + + if (pdata->initial_brightness > pdata->max_brightness) + pdata->initial_brightness = pdata->max_brightness; props.brightness = pdata->initial_brightness; - props.max_brightness = - (pdata->max_brightness < pdata->initial_brightness) ? - 255 : pdata->max_brightness; bl = backlight_device_register(name, lp->dev, lp, &lp855x_bl_ops, &props); -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists