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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130319024336.GD14118@lizard.gateway.2wire.net>
Date:	Mon, 18 Mar 2013 19:43:37 -0700
From:	Anton Vorontsov <anton@...msg.org>
To:	Syam Sidhardhan <syamsidhardh@...il.com>
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	dwmw2@...radead.org
Subject: Re: [PATCH] s3c-adc-battery: Fix possible NULL pointer dereference

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@...sung.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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ