All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: hwmon: (max31790) potential ERR_PTR dereference
Date: Wed, 12 Oct 2016 12:57:50 +0000	[thread overview]
Message-ID: <20161012125750.GA20547@roeck-us.net> (raw)
In-Reply-To: <20161012062452.GX12841@mwanda>

On Wed, Oct 12, 2016 at 09:24:52AM +0300, Dan Carpenter wrote:
> We should only dereference "data" after we check if it is an error
> pointer.
> 
> Fixes: 54187ff9d766 ('hwmon: (max31790) Convert to use new hwmon registration API')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

Thanks,
Guenter

> ---
> To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c
> index bef84e0..c1b9275 100644
> --- a/drivers/hwmon/max31790.c
> +++ b/drivers/hwmon/max31790.c
> @@ -268,11 +268,13 @@ static int max31790_read_pwm(struct device *dev, u32 attr, int channel,
>  			     long *val)
>  {
>  	struct max31790_data *data = max31790_update_device(dev);
> -	u8 fan_config = data->fan_config[channel];
> +	u8 fan_config;
>  
>  	if (IS_ERR(data))
>  		return PTR_ERR(data);
>  
> +	fan_config = data->fan_config[channel];
> +
>  	switch (attr) {
>  	case hwmon_pwm_input:
>  		*val = data->pwm[channel] >> 8;

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: hwmon: (max31790) potential ERR_PTR dereference
Date: Wed, 12 Oct 2016 05:57:50 -0700	[thread overview]
Message-ID: <20161012125750.GA20547@roeck-us.net> (raw)
In-Reply-To: <20161012062452.GX12841@mwanda>

On Wed, Oct 12, 2016 at 09:24:52AM +0300, Dan Carpenter wrote:
> We should only dereference "data" after we check if it is an error
> pointer.
> 
> Fixes: 54187ff9d766 ('hwmon: (max31790) Convert to use new hwmon registration API')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

Thanks,
Guenter

> ---
> To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c
> index bef84e0..c1b9275 100644
> --- a/drivers/hwmon/max31790.c
> +++ b/drivers/hwmon/max31790.c
> @@ -268,11 +268,13 @@ static int max31790_read_pwm(struct device *dev, u32 attr, int channel,
>  			     long *val)
>  {
>  	struct max31790_data *data = max31790_update_device(dev);
> -	u8 fan_config = data->fan_config[channel];
> +	u8 fan_config;
>  
>  	if (IS_ERR(data))
>  		return PTR_ERR(data);
>  
> +	fan_config = data->fan_config[channel];
> +
>  	switch (attr) {
>  	case hwmon_pwm_input:
>  		*val = data->pwm[channel] >> 8;

  reply	other threads:[~2016-10-12 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12  6:24 [patch] hwmon: (max31790) potential ERR_PTR dereference Dan Carpenter
2016-10-12  6:24 ` Dan Carpenter
2016-10-12 12:57 ` Guenter Roeck [this message]
2016-10-12 12:57   ` Guenter Roeck

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=20161012125750.GA20547@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=dan.carpenter@oracle.com \
    --cc=jdelvare@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-hwmon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.