drivers/soc/qcom/socinfo.c:277 qcom_show_pmic_model() error: buffer overflow 'pmic_models' 26 <= 26
From: kernel test robot
Date: Sat Aug 08 2020 - 03:02:53 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 049eb096da48db0421dd5e358b9b082a1a8a2025
commit: e9247e2ce5778678c8d631e26ef79dbccedbe6d0 soc: qcom: socinfo: fix printing of pmic_model
date: 6 weeks ago
config: x86_64-randconfig-m001-20200808 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
New smatch warnings:
drivers/soc/qcom/socinfo.c:277 qcom_show_pmic_model() error: buffer overflow 'pmic_models' 26 <= 26
Old smatch warnings:
drivers/soc/qcom/socinfo.c:278 qcom_show_pmic_model() error: buffer overflow 'pmic_models' 26 <= 26
vim +/pmic_models +277 drivers/soc/qcom/socinfo.c
268
269 static int qcom_show_pmic_model(struct seq_file *seq, void *p)
270 {
271 struct socinfo *socinfo = seq->private;
272 int model = SOCINFO_MINOR(le32_to_cpu(socinfo->pmic_model));
273
274 if (model < 0)
275 return -EINVAL;
276
> 277 if (model <= ARRAY_SIZE(pmic_models) && pmic_models[model])
278 seq_printf(seq, "%s\n", pmic_models[model]);
279 else
280 seq_printf(seq, "unknown (%d)\n", model);
281
282 return 0;
283 }
284
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip