* [kees:for-next/overflow 9/25] drivers/hid/hid-cp2112.c:1001:20: warning: The left operand of '<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
@ 2021-08-23 5:58 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-23 5:58 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 17724 bytes --]
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Kees Cook <keescook@chromium.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/overflow
head: 18ce9ecf54d4ad2826d3afe3b128a00d4a9a5201
commit: 232675b80b509e7d0e931ce7e57600011939133c [9/25] HID: cp2112: Use struct_group() for memcpy() region
:::::: branch date: 22 hours ago
:::::: commit date: 23 hours ago
config: arm-randconfig-c002-20210822 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a83d99c55ebb14532c414066a5aa3bdb65389965)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=232675b80b509e7d0e931ce7e57600011939133c
git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
git fetch --no-tags kees for-next/overflow
git checkout 232675b80b509e7d0e931ce7e57600011939133c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1503:4: note: Taking false branch
if (temp != data)
^
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1499:45: note: The value 2 is assigned to 'i'
for (i = 0; i < adev->sdma.num_instances; i++) {
^~~
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1499:15: note: Assuming 'i' is < field 'num_instances'
for (i = 0; i < adev->sdma.num_instances; i++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1499:3: note: Loop condition is true. Entering loop body
for (i = 0; i < adev->sdma.num_instances; i++) {
^
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:1500:44: note: The right operand of '+' is a garbage value due to array index out of bounds
temp = data = RREG32(mmSDMA0_POWER_CNTL + sdma_offsets[i]);
^
drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:1155:47: note: expanded from macro 'RREG32'
#define RREG32(reg) amdgpu_device_rreg(adev, (reg), 0)
^~~
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
drivers/i2c/busses/i2c-designware-master.c:107:3: warning: Value stored to 'fp_str' is never read [clang-analyzer-deadcode.DeadStores]
fp_str = " Plus";
^ ~~~~~~~
drivers/i2c/busses/i2c-designware-master.c:107:3: note: Value stored to 'fp_str' is never read
fp_str = " Plus";
^ ~~~~~~~
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
drivers/mfd/qcom-spmi-pmic.c:90:3: warning: Value stored to 'name' is never read [clang-analyzer-deadcode.DeadStores]
name = pmic_spmi_id_table[i].compatible;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mfd/qcom-spmi-pmic.c:90:3: note: Value stored to 'name' is never read
name = pmic_spmi_id_table[i].compatible;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
>> drivers/hid/hid-cp2112.c:1001:20: warning: The left operand of '<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (report.length < 2) {
~~~~~~~~~~~~~ ^
drivers/hid/hid-cp2112.c:984:28: note: Left side of '&&' is false
struct hid_device *hdev = to_hid_device(kdev);
^
include/linux/hid.h:633:2: note: expanded from macro 'to_hid_device'
container_of(pdev, struct hid_device, dev)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/hid/hid-cp2112.c:984:28: note: Taking false branch
struct hid_device *hdev = to_hid_device(kdev);
^
include/linux/hid.h:633:2: note: expanded from macro 'to_hid_device'
container_of(pdev, struct hid_device, dev)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/hid/hid-cp2112.c:984:28: note: Loop condition is false. Exiting loop
struct hid_device *hdev = to_hid_device(kdev);
^
include/linux/hid.h:633:2: note: expanded from macro 'to_hid_device'
container_of(pdev, struct hid_device, dev)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
drivers/hid/hid-cp2112.c:986:3: note: Left side of '&&' is false
container_of(kattr, struct cp2112_pstring_attribute, attr);
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/hid/hid-cp2112.c:986:3: note: Taking false branch
container_of(kattr, struct cp2112_pstring_attribute, attr);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/hid/hid-cp2112.c:986:3: note: Loop condition is false. Exiting loop
container_of(kattr, struct cp2112_pstring_attribute, attr);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
drivers/hid/hid-cp2112.c:993:6: note: Assuming 'ret' is >= 3
if (ret < 3) {
^~~~~~~
drivers/hid/hid-cp2112.c:993:2: note: Taking false branch
if (ret < 3) {
vim +1001 drivers/hid/hid-cp2112.c
e932d817866770 David Barksdale 2014-02-04 980
e932d817866770 David Barksdale 2014-02-04 981 static ssize_t pstr_show(struct device *kdev,
e932d817866770 David Barksdale 2014-02-04 982 struct device_attribute *kattr, char *buf)
e932d817866770 David Barksdale 2014-02-04 983 {
ee79a8f840a45d Geliang Tang 2015-12-27 984 struct hid_device *hdev = to_hid_device(kdev);
e932d817866770 David Barksdale 2014-02-04 985 struct cp2112_pstring_attribute *attr =
e932d817866770 David Barksdale 2014-02-04 986 container_of(kattr, struct cp2112_pstring_attribute, attr);
e932d817866770 David Barksdale 2014-02-04 987 struct cp2112_string_report report;
e932d817866770 David Barksdale 2014-02-04 988 u8 length;
e932d817866770 David Barksdale 2014-02-04 989 int ret;
e932d817866770 David Barksdale 2014-02-04 990
232675b80b509e Kees Cook 2021-06-20 991 ret = cp2112_hid_get(hdev, attr->report, (u8 *)&report.contents,
232675b80b509e Kees Cook 2021-06-20 992 sizeof(report.contents), HID_FEATURE_REPORT);
e932d817866770 David Barksdale 2014-02-04 993 if (ret < 3) {
e932d817866770 David Barksdale 2014-02-04 994 hid_err(hdev, "error reading %s string: %d\n", kattr->attr.name,
e932d817866770 David Barksdale 2014-02-04 995 ret);
e932d817866770 David Barksdale 2014-02-04 996 if (ret < 0)
e932d817866770 David Barksdale 2014-02-04 997 return ret;
e932d817866770 David Barksdale 2014-02-04 998 return -EIO;
e932d817866770 David Barksdale 2014-02-04 999 }
e932d817866770 David Barksdale 2014-02-04 1000
e932d817866770 David Barksdale 2014-02-04 @1001 if (report.length < 2) {
e932d817866770 David Barksdale 2014-02-04 1002 hid_err(hdev, "invalid %s string length: %d\n",
e932d817866770 David Barksdale 2014-02-04 1003 kattr->attr.name, report.length);
e932d817866770 David Barksdale 2014-02-04 1004 return -EIO;
e932d817866770 David Barksdale 2014-02-04 1005 }
e932d817866770 David Barksdale 2014-02-04 1006
e932d817866770 David Barksdale 2014-02-04 1007 length = report.length > ret - 1 ? ret - 1 : report.length;
e932d817866770 David Barksdale 2014-02-04 1008 length = (length - 2) / sizeof(report.string[0]);
e932d817866770 David Barksdale 2014-02-04 1009 ret = utf16s_to_utf8s(report.string, length, UTF16_LITTLE_ENDIAN, buf,
e932d817866770 David Barksdale 2014-02-04 1010 PAGE_SIZE - 1);
e932d817866770 David Barksdale 2014-02-04 1011 buf[ret++] = '\n';
e932d817866770 David Barksdale 2014-02-04 1012 return ret;
e932d817866770 David Barksdale 2014-02-04 1013 }
e932d817866770 David Barksdale 2014-02-04 1014
:::::: The code at line 1001 was first introduced by commit
:::::: e932d817866770d456815c9a84b7ed94f0589d80 HID: add hid-cp2112 driver
:::::: TO: David Barksdale <dbarksdale@uplogix.com>
:::::: CC: Jiri Kosina <jkosina@suse.cz>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37311 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-23 5:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 5:58 [kees:for-next/overflow 9/25] drivers/hid/hid-cp2112.c:1001:20: warning: The left operand of '<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult] 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.