* [linux-next:master 2255/4921] drivers/hwmon/asus_wmi_ec_sensors.c:562 asus_wmi_ec_configure_sensor_setup() error: buffer overflow 'hwmon_attributes' 8 <= 9
@ 2021-12-02 12:39 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-12-02 12:39 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6519 bytes --]
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Denis Pauk <pauk.denis@gmail.com>
CC: Guenter Roeck <linux@roeck-us.net>
CC: Eugene Shalygin <eugene.shalygin@gmail.com>
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 9606f9efb1cec7f8f5912326f182fbfbcad34382
commit: c04c7f7bfcbe2f11f83a00b624990e4dd8d46d3d [2255/4921] hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.
:::::: branch date: 6 hours ago
:::::: commit date: 12 days ago
config: x86_64-randconfig-m001-20211201 (https://download.01.org/0day-ci/archive/20211202/202112022013.afBXgpY7-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/hwmon/asus_wmi_ec_sensors.c:562 asus_wmi_ec_configure_sensor_setup() error: buffer overflow 'hwmon_attributes' 8 <= 9
vim +/hwmon_attributes +562 drivers/hwmon/asus_wmi_ec_sensors.c
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 504
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 505 static int asus_wmi_ec_configure_sensor_setup(struct device *dev,
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 506 const enum known_ec_sensor *bsi)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 507 {
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 508 struct asus_wmi_sensors *sensor_data = dev_get_drvdata(dev);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 509 struct asus_wmi_ec_info *ec = &sensor_data->ec;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 510 struct hwmon_channel_info *asus_wmi_hwmon_chan;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 511 const struct hwmon_channel_info **asus_wmi_ci;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 512 int nr_count[hwmon_max] = {}, nr_types = 0;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 513 const struct hwmon_chip_info *chip_info;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 514 const struct ec_sensor_info *si;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 515 enum hwmon_sensor_types type;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 516 struct device *hwdev;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 517 int i, ret;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 518
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 519 ret = asus_wmi_ec_fill_board_sensors(ec, bsi);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 520 if (ret)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 521 return ret;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 522
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 523 if (!sensor_data->ec.nr_sensors)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 524 return -ENODEV;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 525
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 526 for (i = 0; i < ec->nr_sensors; i++) {
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 527 si = &known_ec_sensors[ec->sensors[i].info_index];
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 528 if (!nr_count[si->type])
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 529 nr_types++;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 530 nr_count[si->type]++;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 531 }
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 532
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 533 if (nr_count[hwmon_temp]) {
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 534 nr_count[hwmon_chip]++;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 535 nr_types++;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 536 }
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 537
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 538 /*
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 539 * If we can get values for all the registers in a single query,
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 540 * the query will not change from call to call.
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 541 */
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 542 asus_wmi_ec_make_block_read_query(ec);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 543
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 544 asus_wmi_hwmon_chan = devm_kcalloc(dev, nr_types, sizeof(*asus_wmi_hwmon_chan),
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 545 GFP_KERNEL);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 546 if (!asus_wmi_hwmon_chan)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 547 return -ENOMEM;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 548
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 549 asus_wmi_ci = devm_kcalloc(dev, nr_types + 1, sizeof(*asus_wmi_ci), GFP_KERNEL);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 550 if (!asus_wmi_ci)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 551 return -ENOMEM;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 552
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 553 asus_wmi_ec_chip_info.info = asus_wmi_ci;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 554 chip_info = &asus_wmi_ec_chip_info;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 555
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 556 for (type = 0; type < hwmon_max; type++) {
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 557 if (!nr_count[type])
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 558 continue;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 559
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 560 ret = asus_wmi_hwmon_add_chan_info(asus_wmi_hwmon_chan, dev,
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 561 nr_count[type], type,
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 @562 hwmon_attributes[type]);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 563 if (ret)
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 564 return ret;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 565
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 566 *asus_wmi_ci++ = asus_wmi_hwmon_chan++;
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 567 }
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 568
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 569 dev_dbg(dev, "board has %d EC sensors that span %d registers",
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 570 ec->nr_sensors, ec->nr_registers);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 571
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 572 hwdev = devm_hwmon_device_register_with_info(dev, "asus_wmi_ec_sensors",
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 573 sensor_data, chip_info, NULL);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 574
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 575 return PTR_ERR_OR_ZERO(hwdev);
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 576 }
c04c7f7bfcbe2f1 Denis Pauk 2021-11-16 577
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-02 12:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 12:39 [linux-next:master 2255/4921] drivers/hwmon/asus_wmi_ec_sensors.c:562 asus_wmi_ec_configure_sensor_setup() error: buffer overflow 'hwmon_attributes' 8 <= 9 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.