netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton@enomsg.org>
To: Syam Sidhardhan <syamsidhardh@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	dwmw2@infradead.org
Subject: Re: [PATCH] s3c-adc-battery: Fix possible NULL pointer dereference
Date: Mon, 18 Mar 2013 19:43:37 -0700	[thread overview]
Message-ID: <20130319024336.GD14118@lizard.gateway.2wire.net> (raw)
In-Reply-To: <1361747005-29306-1-git-send-email-s.syam@samsung.com>

On Mon, Feb 25, 2013 at 04:33:25AM +0530, Syam Sidhardhan wrote:
> Check for (bat == NULL) has to be done before accessing bat
> 
> Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
> ---

Applied, thanks!

>  drivers/power/s3c_adc_battery.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/s3c_adc_battery.c b/drivers/power/s3c_adc_battery.c
> index d2ca989..5948ce0 100644
> --- a/drivers/power/s3c_adc_battery.c
> +++ b/drivers/power/s3c_adc_battery.c
> @@ -145,14 +145,17 @@ static int s3c_adc_bat_get_property(struct power_supply *psy,
>  
>  	int new_level;
>  	int full_volt;
> -	const struct s3c_adc_bat_thresh *lut = bat->pdata->lut_noac;
> -	unsigned int lut_size = bat->pdata->lut_noac_cnt;
> +	const struct s3c_adc_bat_thresh *lut;
> +	unsigned int lut_size;
>  
>  	if (!bat) {
>  		dev_err(psy->dev, "no battery infos ?!\n");
>  		return -EINVAL;
>  	}
>  
> +	lut = bat->pdata->lut_noac;
> +	lut_size = bat->pdata->lut_noac_cnt;
> +
>  	if (bat->volt_value < 0 || bat->cur_value < 0 ||
>  		jiffies_to_msecs(jiffies - bat->timestamp) >
>  			BAT_POLL_INTERVAL) {
> -- 
> 1.7.9.5

      reply	other threads:[~2013-03-19  2:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 23:03 [PATCH] s3c-adc-battery: Fix possible NULL pointer dereference Syam Sidhardhan
2013-03-19  2:43 ` Anton Vorontsov [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=20130319024336.GD14118@lizard.gateway.2wire.net \
    --to=anton@enomsg.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syamsidhardh@gmail.com \
    /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).