From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v2] drivers/cdrom: improved ioctl for media change detection
Date: Wed, 01 Sep 2021 02:08:09 +0800 [thread overview]
Message-ID: <202109010116.36BKHu4N-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 15936 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210829143735.512146-1-lumip@lumip.de>
References: <20210829143735.512146-1-lumip@lumip.de>
TO: Lukas Prediger <lumip@lumip.de>
TO: axboe(a)kernel.dk
CC: linux-kernel(a)vger.kernel.org
CC: Lukas Prediger <lumip@lumip.de>
Hi Lukas,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.14 next-20210831]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Lukas-Prediger/drivers-cdrom-improved-ioctl-for-media-change-detection/20210829-224230
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c54b245d011855ea91c5beff07f1db74143ce614
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20210830 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
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://github.com/0day-ci/linux/commit/7137a773f62ec45b6e321b0bf555d3459ac9510d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lukas-Prediger/drivers-cdrom-improved-ioctl-for-media-change-detection/20210829-224230
git checkout 7137a773f62ec45b6e321b0bf555d3459ac9510d
# 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 >>)
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/vhost/scsi.c:2056:31: note: Loop condition is false. Exiting loop
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
^
include/linux/kernel.h:704: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/vhost/scsi.c:2056:2: note: 'tpg' initialized to a null pointer value
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/vhost/scsi.c:2059:12: note: Calling 'kstrtoul'
int ret = kstrtoul(page, 0, &val);
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:219:58: note: Left side of '&&' is false
if (sizeof(unsigned long) == sizeof(unsigned long long) &&
^
include/linux/kernel.h:223:3: note: Returning value, which participates in a condition later
return _kstrtoul(s, base, res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/vhost/scsi.c:2059:12: note: Returning from 'kstrtoul'
int ret = kstrtoul(page, 0, &val);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/vhost/scsi.c:2061:6: note: Assuming 'ret' is 0
if (ret) {
^~~
drivers/vhost/scsi.c:2061:2: note: Taking false branch
if (ret) {
^
drivers/vhost/scsi.c:2065:6: note: Assuming 'val' is equal to 0
if (val != 0 && val != 1 && val != 3) {
^~~~~~~~
drivers/vhost/scsi.c:2065:15: note: Left side of '&&' is false
if (val != 0 && val != 1 && val != 3) {
^
drivers/vhost/scsi.c:2069:27: note: Access to field 'tv_fabric_prot_type' results in a dereference of a null pointer (loaded from variable 'tpg')
tpg->tv_fabric_prot_type = val;
~~~ ^
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.
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.
4 warnings generated.
drivers/block/paride/fit3.c:86:13: warning: Value stored to 'b' is never read [clang-analyzer-deadcode.DeadStores]
a = r4(); b = r4();
^
drivers/block/paride/fit3.c:86:13: note: Value stored to 'b' is never read
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.
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.
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.
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.
7 warnings generated.
drivers/block/paride/pd.c:348:9: warning: Although the value stored to 'block' is used in the enclosing expression, the value is never actually read from 'block' [clang-analyzer-deadcode.DeadStores]
h = ((block >>= 8) & 15) + 0x40;
^ ~
drivers/block/paride/pd.c:348:9: note: Although the value stored to 'block' is used in the enclosing expression, the value is never actually read from 'block'
h = ((block >>= 8) & 15) + 0x40;
^ ~
drivers/block/paride/pd.c:353:9: warning: Although the value stored to 'block' is used in the enclosing expression, the value is never actually read from 'block' [clang-analyzer-deadcode.DeadStores]
c1 = (block >>= 8);
^ ~
drivers/block/paride/pd.c:353:9: note: Although the value stored to 'block' is used in the enclosing expression, the value is never actually read from 'block'
c1 = (block >>= 8);
^ ~
drivers/block/paride/pd.c:686:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
r = pd_wait_for(disk, STAT_READY, DBMSG("RDY after VRFY"));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pd.c:686:3: note: Value stored to 'r' is never read
r = pd_wait_for(disk, STAT_READY, DBMSG("RDY after VRFY"));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pd.c:886:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(p->disk_name, disk->name);
^~~~~~
drivers/block/paride/pd.c:886:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(p->disk_name, disk->name);
^~~~~~
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.
9 warnings generated.
>> drivers/block/paride/pcd.c:193:8: warning: Excessive padding in 'struct pcd_unit' (8 padding bytes, where 0 is optimal).
Optimal fields order:
info,
pi,
drive,
last_sense,
changed,
present,
name,
disk,
rq_list,
pia,
tag_set,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct pcd_unit {
~~~~~~~^~~~~~~~~~
drivers/block/paride/pcd.c:193:8: note: Excessive padding in 'struct pcd_unit' (8 padding bytes, where 0 is optimal). Optimal fields order: info, pi, drive, last_sense, changed, present, name, disk, rq_list, pia, tag_set, consider reordering the fields or adding explicit padding members
struct pcd_unit {
~~~~~~~^~~~~~~~~~
drivers/block/paride/pcd.c:346:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(disk->disk_name, cd->name); /* umm... */
^~~~~~
drivers/block/paride/pcd.c:346:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(disk->disk_name, cd->name); /* umm... */
^~~~~~
drivers/block/paride/pcd.c:503:33: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
cd->name, fun, buf[2] & 0xf, buf[12], buf[13]);
^
drivers/block/paride/pcd.c:1010:6: note: Assuming 'disable' is 0
if (disable)
^~~~~~~
drivers/block/paride/pcd.c:1010:2: note: Taking false branch
if (disable)
^
drivers/block/paride/pcd.c:1015:2: note: Taking false branch
if (pcd_detect())
^
drivers/block/paride/pcd.c:1019:2: note: Calling 'pcd_probe_capabilities'
pcd_probe_capabilities();
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pcd.c:689:2: note: Loop condition is true. Entering loop body
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
^
drivers/block/paride/pcd.c:690:12: note: Field 'present' is 1
if (!cd->present)
^
drivers/block/paride/pcd.c:690:3: note: Taking false branch
if (!cd->present)
^
drivers/block/paride/pcd.c:692:7: note: Calling 'pcd_atapi'
r = pcd_atapi(cd, cmd, 18, buffer, "mode sense capabilities");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pcd.c:516:6: note: Calling 'pcd_command'
r = pcd_command(cd, cmd, dlen, fun);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pcd.c:410:6: note: Assuming the condition is true
if (pcd_wait(cd, IDE_BUSY | IDE_DRQ, 0, fun, "before command")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pcd.c:410:2: note: Taking true branch
if (pcd_wait(cd, IDE_BUSY | IDE_DRQ, 0, fun, "before command")) {
^
drivers/block/paride/pcd.c:412:3: note: Returning the value -1, which participates in a condition later
return -1;
^~~~~~~~~
drivers/block/paride/pcd.c:516:6: note: Returning from 'pcd_command'
r = pcd_command(cd, cmd, dlen, fun);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/paride/pcd.c:517:2: note: Left side of '&&' is true
mdelay(1);
^
include/linux/delay.h:44:3: note: expanded from macro 'mdelay'
(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
^
drivers/block/paride/pcd.c:517:2: note: 1 is <= 2
mdelay(1);
^
include/linux/delay.h:44:30: note: expanded from macro 'mdelay'
(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
^~~
drivers/block/paride/pcd.c:517:2: note: '?' condition is true
mdelay(1);
^
include/linux/delay.h:44:2: note: expanded from macro 'mdelay'
(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
^
drivers/block/paride/pcd.c:517:2: note: '?' condition is true
mdelay(1);
^
include/linux/delay.h:44:52: note: expanded from macro 'mdelay'
(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
^
arch/arm/include/asm/delay.h:83:3: note: expanded from macro 'udelay'
(__builtin_constant_p(n) ? \
^
drivers/block/paride/pcd.c:517:2: note: '?' condition is false
mdelay(1);
^
include/linux/delay.h:44:52: note: expanded from macro 'mdelay'
(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
^
arch/arm/include/asm/delay.h:84:5: note: expanded from macro 'udelay'
vim +193 drivers/block/paride/pcd.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 192
^1da177e4c3f41 Linus Torvalds 2005-04-16 @193 struct pcd_unit {
^1da177e4c3f41 Linus Torvalds 2005-04-16 194 struct pi_adapter pia; /* interface to paride layer */
^1da177e4c3f41 Linus Torvalds 2005-04-16 195 struct pi_adapter *pi;
^1da177e4c3f41 Linus Torvalds 2005-04-16 196 int drive; /* master/slave */
^1da177e4c3f41 Linus Torvalds 2005-04-16 197 int last_sense; /* result of last request sense */
^1da177e4c3f41 Linus Torvalds 2005-04-16 198 int changed; /* media change seen */
^1da177e4c3f41 Linus Torvalds 2005-04-16 199 int present; /* does this unit exist ? */
^1da177e4c3f41 Linus Torvalds 2005-04-16 200 char *name; /* pcd0, pcd1, etc */
^1da177e4c3f41 Linus Torvalds 2005-04-16 201 struct cdrom_device_info info; /* uniform cdrom interface */
^1da177e4c3f41 Linus Torvalds 2005-04-16 202 struct gendisk *disk;
89c6b165096933 Jens Axboe 2018-10-15 203 struct blk_mq_tag_set tag_set;
89c6b165096933 Jens Axboe 2018-10-15 204 struct list_head rq_list;
^1da177e4c3f41 Linus Torvalds 2005-04-16 205 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 206
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32584 bytes --]
next reply other threads:[~2021-08-31 18:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 18:08 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-29 14:37 [PATCH v2] drivers/cdrom: improved ioctl for media change detection Lukas Prediger
2021-09-06 20:11 ` Jens Axboe
2021-09-06 22:57 ` Phillip Potter
2021-09-08 23:51 ` Phillip Potter
2021-09-09 18:04 ` Lukas Prediger
2021-09-09 23:07 ` Phillip Potter
2021-09-07 6:35 ` Christoph Hellwig
2021-09-09 0:17 ` Phillip Potter
2021-09-09 0:42 ` Randy Dunlap
2021-09-09 18:05 ` Lukas Prediger
2021-09-09 23:20 ` Phillip Potter
2021-09-10 1:25 ` Randy Dunlap
2021-09-10 7:59 ` Phillip Potter
2021-09-09 23:00 ` Phillip Potter
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=202109010116.36BKHu4N-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/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 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.