From: Frank Crawford <frank@crawford.emu.id.au>
To: Guenter Roeck <linux@roeck-us.net>,
Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [bug report] hwmon: (it87) Test for error in it87_update_device
Date: Sat, 22 Apr 2023 11:55:39 +1000 [thread overview]
Message-ID: <e70ae5944d7bc45e64410954442ba3f8e64cca27.camel@crawford.emu.id.au> (raw)
In-Reply-To: <262b6016-5b50-4bf2-cf2d-a316bc5f81a7@roeck-us.net>
On Fri, 2023-04-21 at 07:28 -0700, Guenter Roeck wrote:
> On 4/21/23 03:45, Dan Carpenter wrote:
> > Hello Frank Crawford,
> >
> > The patch 27302e7a46f5: "hwmon: (it87) Test for error in
> > it87_update_device" from Apr 16, 2023, leads to the following
> > Smatch
> > static checker warning:
> >
> > drivers/hwmon/it87.c:1147 show_temp_type()
> > error: 'data' dereferencing possible ERR_PTR()
> >
>
> I updated the original patch. No need to send a fix or new version.
Thanks for that Guenter.
>
> Thanks,
> Guenter
Regards
Frank
>
> > drivers/hwmon/it87.c
> > 1141 static ssize_t show_temp_type(struct device *dev, struct
> > device_attribute *attr,
> > 1142 char *buf)
> > 1143 {
> > 1144 struct sensor_device_attribute *sensor_attr =
> > to_sensor_dev_attr(attr);
> > 1145 int nr = sensor_attr->index;
> > 1146 struct it87_data *data = it87_update_device(dev);
> > --> 1147 u8 reg = data->sensor; /* In case value
> > is updated while used */
> > ^^^^^^^^^^^^
> > 1148 u8 extra = data->extra;
> > ^^^^^^^^^^^
> >
> > 1149
> > 1150 if (IS_ERR(data))
> >
> > This new check happens too late.
> >
> > 1151 return PTR_ERR(data);
> > 1152
> >
> > regards,
> > dan carpenter
>
prev parent reply other threads:[~2023-04-22 1:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 10:45 [bug report] hwmon: (it87) Test for error in it87_update_device Dan Carpenter
2023-04-21 14:28 ` Guenter Roeck
2023-04-22 1:55 ` Frank Crawford [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=e70ae5944d7bc45e64410954442ba3f8e64cca27.camel@crawford.emu.id.au \
--to=frank@crawford.emu.id.au \
--cc=dan.carpenter@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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).