* [linux-next:master 5126/5916] drivers/hwmon/axiado-tsadc.c:142 axiado_tsadc_raw_to_mc() error: buffer overflow 'axiado_tsadc_table' 34 <= 34
@ 2026-09-12 14:52 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-12 14:52 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Petar Stepanovic <pstepanovic@axiado.com>
CC: Guenter Roeck <linux@roeck-us.net>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 68142f986ff04b2b70b31db00f719bf690f64a9a
commit: 94761a45a7544d0d694767898327b2f797a47fe7 [5126/5916] hwmon: axiado-tsadc: Add AX3000/AX3005 TSADC support
:::::: branch date: 23 hours ago
:::::: commit date: 3 days ago
config: powerpc64-randconfig-r072-20260911 (https://download.01.org/0day-ci/archive/20260912/202609121642.l9tp42kr-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 707c032dae3bee24eae29c6f4c459a6d6dc6556d)
smatch: v0.5.0-9187-g5189e3fb
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202609121642.l9tp42kr-lkp@intel.com/
New smatch warnings:
drivers/hwmon/axiado-tsadc.c:142 axiado_tsadc_raw_to_mc() error: buffer overflow 'axiado_tsadc_table' 34 <= 34
Old smatch warnings:
drivers/hwmon/axiado-tsadc.c:144 axiado_tsadc_raw_to_mc() error: buffer overflow 'axiado_tsadc_table' 34 <= 34
vim +/axiado_tsadc_table +142 drivers/hwmon/axiado-tsadc.c
94761a45a7544d Petar Stepanovic 2026-09-03 113
94761a45a7544d Petar Stepanovic 2026-09-03 114 /* Convert raw ADC code to millidegrees Celsius with linear interpolation. */
94761a45a7544d Petar Stepanovic 2026-09-03 115 static int axiado_tsadc_raw_to_mc(u32 raw, long *val)
94761a45a7544d Petar Stepanovic 2026-09-03 116 {
94761a45a7544d Petar Stepanovic 2026-09-03 117 int i, n = ARRAY_SIZE(axiado_tsadc_table);
94761a45a7544d Petar Stepanovic 2026-09-03 118 long num, denom;
94761a45a7544d Petar Stepanovic 2026-09-03 119
94761a45a7544d Petar Stepanovic 2026-09-03 120 if (raw >= axiado_tsadc_table[0].raw) {
94761a45a7544d Petar Stepanovic 2026-09-03 121 *val = axiado_tsadc_table[0].temp_mc;
94761a45a7544d Petar Stepanovic 2026-09-03 122 return 0;
94761a45a7544d Petar Stepanovic 2026-09-03 123 }
94761a45a7544d Petar Stepanovic 2026-09-03 124
94761a45a7544d Petar Stepanovic 2026-09-03 125 if (raw <= axiado_tsadc_table[n - 1].raw) {
94761a45a7544d Petar Stepanovic 2026-09-03 126 *val = axiado_tsadc_table[n - 1].temp_mc;
94761a45a7544d Petar Stepanovic 2026-09-03 127 return 0;
94761a45a7544d Petar Stepanovic 2026-09-03 128 }
94761a45a7544d Petar Stepanovic 2026-09-03 129
94761a45a7544d Petar Stepanovic 2026-09-03 130 /* Find i such that axiado_tsadc_table[i].raw >= raw > axiado_tsadc_table[i+1].raw */
94761a45a7544d Petar Stepanovic 2026-09-03 131 for (i = 0; i < n - 1; i++) {
94761a45a7544d Petar Stepanovic 2026-09-03 132 if (raw >= axiado_tsadc_table[i + 1].raw)
94761a45a7544d Petar Stepanovic 2026-09-03 133 break;
94761a45a7544d Petar Stepanovic 2026-09-03 134 }
94761a45a7544d Petar Stepanovic 2026-09-03 135
94761a45a7544d Petar Stepanovic 2026-09-03 136 if (raw == axiado_tsadc_table[i].raw) {
94761a45a7544d Petar Stepanovic 2026-09-03 137 *val = axiado_tsadc_table[i].temp_mc;
94761a45a7544d Petar Stepanovic 2026-09-03 138 return 0;
94761a45a7544d Petar Stepanovic 2026-09-03 139 }
94761a45a7544d Petar Stepanovic 2026-09-03 140
94761a45a7544d Petar Stepanovic 2026-09-03 141 /* Linear interpolation within the interval */
94761a45a7544d Petar Stepanovic 2026-09-03 @142 num = (long)(axiado_tsadc_table[i + 1].temp_mc - axiado_tsadc_table[i].temp_mc) *
94761a45a7544d Petar Stepanovic 2026-09-03 143 (axiado_tsadc_table[i].raw - raw);
94761a45a7544d Petar Stepanovic 2026-09-03 144 denom = axiado_tsadc_table[i].raw - axiado_tsadc_table[i + 1].raw;
94761a45a7544d Petar Stepanovic 2026-09-03 145 *val = axiado_tsadc_table[i].temp_mc + num / denom;
94761a45a7544d Petar Stepanovic 2026-09-03 146 return 0;
94761a45a7544d Petar Stepanovic 2026-09-03 147 }
94761a45a7544d Petar Stepanovic 2026-09-03 148
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-12 14:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-12 14:52 [linux-next:master 5126/5916] drivers/hwmon/axiado-tsadc.c:142 axiado_tsadc_raw_to_mc() error: buffer overflow 'axiado_tsadc_table' 34 <= 34 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.