From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [linux-next:master 5126/5916] drivers/hwmon/axiado-tsadc.c:142 axiado_tsadc_raw_to_mc() error: buffer overflow 'axiado_tsadc_table' 34 <= 34
Date: Sat, 12 Sep 2026 16:52:50 +0200 [thread overview]
Message-ID: <202609121642.l9tp42kr-lkp@intel.com> (raw)
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
reply other threads:[~2026-09-12 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202609121642.l9tp42kr-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox