Re: [PATCH] hwmon: it87: describe per-chip temperature resources

From: Dan Carpenter

Date: Wed Jan 07 2026 - 17:39:04 EST


On Wed, Jan 07, 2026 at 08:18:53PM +0100, Benoit Masson wrote:
> On Mon, Jan 5, 2026 at 11:10 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> >
> > Hi benoit.masson,
> >
> > kernel test robot noticed the following build warnings:
> >
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> >
> > url: https://github.com/intel-lab-lkp/linux/commits/benoit-masson/hwmon-it87-describe-per-chip-temperature-resources/20251227-043108
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
> > patch link: https://lore.kernel.org/r/20251226203021.27244-1-yahoo%40perenite.com
> > patch subject: [PATCH] hwmon: it87: describe per-chip temperature resources
> > config: x86_64-randconfig-161-20251229 (https://download.01.org/0day-ci/archive/20251230/202512300415.VRCQoZYs-lkp@xxxxxxxxx/config)
> > compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > | Closes: https://lore.kernel.org/r/202512300415.VRCQoZYs-lkp@xxxxxxxxx/
> >
> > smatch warnings:
> > drivers/hwmon/it87.c:1694 show_pwm_temp_map() warn: variable dereferenced before IS_ERR check 'data' (see line 1691)
> >
> > vim +/data +1694 drivers/hwmon/it87.c
> >
> > 94ac7ee616809d Jean Delvare 2010-03-05 1685 static ssize_t show_pwm_temp_map(struct device *dev,
> > 94ac7ee616809d Jean Delvare 2010-03-05 1686 struct device_attribute *attr, char *buf)
> > 94ac7ee616809d Jean Delvare 2010-03-05 1687 {
> > 94ac7ee616809d Jean Delvare 2010-03-05 1688 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
> > 94ac7ee616809d Jean Delvare 2010-03-05 1689 struct it87_data *data = it87_update_device(dev);
> > c962024e306ed5 Guenter Roeck 2015-04-04 1690 int nr = sensor_attr->index;
> > 542f1e57c17849 benoit.masson 2025-12-26 @1691 u8 num_map = data->num_temp_map ?: IT87_TEMP_MAP_DEFAULT;
> > ^^^^^^^^^^^^^^^^^^
> > Unchecked dereference
> >
> > 94ac7ee616809d Jean Delvare 2010-03-05 1692 int map;
> > 94ac7ee616809d Jean Delvare 2010-03-05 1693
> > 0282ba4a4fe6c8 Frank Crawford 2023-04-16 @1694 if (IS_ERR(data))
> > ^^^^
> > Checked too late.
> >
> > 0282ba4a4fe6c8 Frank Crawford 2023-04-16 1695 return PTR_ERR(data);
> > 0282ba4a4fe6c8 Frank Crawford 2023-04-16 1696
> > 0624d861983c2c Guenter Roeck 2015-04-06 1697 map = data->pwm_temp_map[nr];
> >
>
> Hi Dan,
>
> Indeed I’d move the num_map assignment below the IS_ERR(data)
>
> Is proposing a new patch V2 below the right appraoch ?

This doesn't seem to have hit linux-next yet, so sending a v2 sounds
good.

regards,
dan carpenter