Re: [bug report] hwmon: add HP WMI Sensors driver

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

 



On Tue, Jul 25, 2023 at 08:17:50AM +0300, Dan Carpenter wrote:
> Hello James Seo,
> 
> The patch 23902f98f8d4: "hwmon: add HP WMI Sensors driver" from May
> 22, 2023 (linux-next), leads to the following Smatch static checker
> warning:
> 
> 	drivers/hwmon/hp-wmi-sensors.c:1937 hp_wmi_sensors_init()
> 	error: uninitialized symbol 'pevents'.
> 
> drivers/hwmon/hp-wmi-sensors.c
>     1913 static int hp_wmi_sensors_init(struct hp_wmi_sensors *state)
>     1914 {
>     1915         struct hp_wmi_info *connected[HP_WMI_MAX_INSTANCES];
>     1916         struct hp_wmi_platform_events *pevents;
>     1917         struct device *dev = &state->wdev->dev;
>     1918         struct hp_wmi_info *info;
>     1919         struct device *hwdev;
>     1920         bool has_events;
>     1921         bool is_new;
>     1922         u8 icount;
>     1923         u8 pcount;
>     1924         u8 count;
>     1925         int err;
>     1926 
>     1927         err = init_platform_events(dev, &pevents, &pcount);
>     1928         if (err)
>     1929                 return err;
>     1930 
>     1931         err = init_numeric_sensors(state, connected, &info,
>     1932                                    &icount, &count, &is_new);
>     1933         if (err)
>     1934                 return err;
>     1935 
>     1936         if (IS_ENABLED(CONFIG_DEBUG_FS))
> --> 1937                 hp_wmi_debugfs_init(dev, info, pevents, icount, pcount, is_new);
> 
> In this code prevents is uninitialized if pcount is zero.  It's not used
> so whether this is a bug or not depends on if hp_wmi_debugfs_init() is
> inlined.  If it's inlined then it's not a bug, but if it isn't then it's
> still a bug (despite that pevents is not used).
> 
Hi Dan,

I appreciate your report and will address this shortly.

James
> 
> 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