hwmon: (amd_energy) fix allocation of hwmon_channel_info config
authorDavid Arcari <darcari@redhat.com>
Thu, 7 Jan 2021 14:47:07 +0000 (09:47 -0500)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 8 Jan 2021 15:31:03 +0000 (07:31 -0800)
commit84e261553e6f919bf0b4d65244599ab2b41f1da5
treedf772388a2344a53a83a2e58882dbede3823c9ad
parent1eda52334e6d13eb1a85f713ce06dd39342b5020
hwmon: (amd_energy) fix allocation of hwmon_channel_info config

hwmon, specifically hwmon_num_channel_attrs, expects the config
array in the hwmon_channel_info structure to be terminated by
a zero entry.  amd_energy does not honor this convention.  As
result, a KASAN warning is possible.  Fix this by adding an
additional entry and setting it to zero.

Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")

Signed-off-by: David Arcari <darcari@redhat.com>
Cc: Naveen Krishna Chatradhi <nchatrad@amd.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: David Arcari <darcari@redhat.com>
Acked-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
Link: https://lore.kernel.org/r/20210107144707.6927-1-darcari@redhat.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/amd_energy.c