From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-fbdev@vger.kernel.org
Subject: [patch 2/2] backlight: lm3630: potential NULL deref in probe()
Date: Wed, 25 Sep 2013 09:36:12 +0000 [thread overview]
Message-ID: <20130925093612.GR6192@mwanda> (raw)
In-Reply-To: <20130925085549.GB6661@elgon.mountain>
We dereference "pdata" later in the function so we can't leave it as
NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index 65392f9..6146481 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -389,22 +389,21 @@ static int lm3630a_probe(struct i2c_client *client,
i2c_set_clientdata(client, pchip);
if (pdata = NULL) {
- pchip->pdata = devm_kzalloc(pchip->dev,
- sizeof(struct
- lm3630a_platform_data),
- GFP_KERNEL);
- if (pchip->pdata = NULL)
+ pdata = devm_kzalloc(pchip->dev,
+ sizeof(struct lm3630a_platform_data),
+ GFP_KERNEL);
+ if (pdata = NULL)
return -ENOMEM;
/* default values */
- pchip->pdata->leda_ctrl = LM3630A_LEDA_ENABLE;
- pchip->pdata->ledb_ctrl = LM3630A_LEDB_ENABLE;
- pchip->pdata->leda_max_brt = LM3630A_MAX_BRIGHTNESS;
- pchip->pdata->ledb_max_brt = LM3630A_MAX_BRIGHTNESS;
- pchip->pdata->leda_init_brt = LM3630A_MAX_BRIGHTNESS;
- pchip->pdata->ledb_init_brt = LM3630A_MAX_BRIGHTNESS;
- } else {
- pchip->pdata = pdata;
+ pdata->leda_ctrl = LM3630A_LEDA_ENABLE;
+ pdata->ledb_ctrl = LM3630A_LEDB_ENABLE;
+ pdata->leda_max_brt = LM3630A_MAX_BRIGHTNESS;
+ pdata->ledb_max_brt = LM3630A_MAX_BRIGHTNESS;
+ pdata->leda_init_brt = LM3630A_MAX_BRIGHTNESS;
+ pdata->ledb_init_brt = LM3630A_MAX_BRIGHTNESS;
}
+ pchip->pdata = pdata;
+
/* chip initialize */
rval = lm3630a_chip_init(pchip);
if (rval < 0) {
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2013-09-25 9:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 8:55 [patch 2/2] backlight: lm3630: potential NULL deref in probe() Dan Carpenter
2013-09-25 9:13 ` Jingoo Han
2013-09-25 9:28 ` Jingoo Han
2013-09-25 9:34 ` Dan Carpenter
2013-09-25 9:36 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130925093612.GR6192@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).