Re: [bug report] hwmon: (it87) Test for error in it87_update_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux