linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <rong.a.chen@intel.com>
To: Damien Le Moal <damien.lemoal@wdc.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: clang-built-linux <clang-built-linux@googlegroups.com>,
	"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Suganath Prabu Subramani  <suganath-prabu.subramani@broadcom.com>
Subject: Re: [PATCH 2/7] libata: cleanup ata_dev_configure()
Date: Tue, 3 Aug 2021 17:08:53 +0800	[thread overview]
Message-ID: <b67cfc18-088e-aaa9-ca36-50c2251742cf@intel.com> (raw)
In-Reply-To: <202108030231.7Ta42o7Q-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 16863 bytes --]


Hi Damien,

I love your patch! Perhaps something to improve:

[auto build test WARNING on block/for-next]
[also build test WARNING on mkp-scsi/for-next scsi/for-next v5.14-rc3 
next-20210730]
[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/Damien-Le-Moal/libata-cleanups-and-improvements/20210802-170443
base: 
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: x86_64-randconfig-c001-20210802 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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 x86_64 cross compiling tool for clang build
         # apt-get install binutils-x86-64-linux-gnu
         # 
https://github.com/0day-ci/linux/commit/5622af0f73c9776b5bdf272dee77d57d62ea03fa
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review 
Damien-Le-Moal/libata-cleanups-and-improvements/20210802-170443
         git checkout 5622af0f73c9776b5bdf272dee77d57d62ea03fa
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 
ARCH=x86_64 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 >>)
    note: (skipping 3 expansions in backtrace; use 
-fmacro-backtrace-limit=0 to see all)
    include/linux/minmax.h:104:48: note: expanded from macro 'min_t'
    #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
    include/linux/minmax.h:38:14: note: expanded from macro '__careful_cmp'
                    __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), 
op))
                    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:31:25: note: expanded from macro '__cmp_once'
                    typeof(x) unique_x = (x);               \
                                          ^
    drivers/hwmon/max6621.c:321:10: note: '?' condition is false
                            val = clamp_val(val, MAX6621_TEMP_INPUT_MIN,
                                  ^
    include/linux/minmax.h:137:32: note: expanded from macro 'clamp_val'
    #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
                                   ^
    include/linux/minmax.h:124:48: note: expanded from macro 'clamp_t'
    #define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
                                                   ^
    include/linux/minmax.h:112:27: note: expanded from macro 'max_t'
    #define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)
                                    ^
    include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                    __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), 
op))
                    ^
    include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                    __cmp(unique_x, unique_y, op); })
                    ^
    include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
    #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                             ^
    drivers/hwmon/max6621.c:321:10: note: '__UNIQUE_ID___x523' is < 
'__UNIQUE_ID___y524'
                            val = clamp_val(val, MAX6621_TEMP_INPUT_MIN,
                                  ^
    include/linux/minmax.h:137:32: note: expanded from macro 'clamp_val'
    #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:124:36: note: expanded from macro 'clamp_t'
    #define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
    #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                    __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), 
op))
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                    __cmp(unique_x, unique_y, op); })
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
    #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                             ^~~
    drivers/hwmon/max6621.c:321:10: note: '?' condition is true
                            val = clamp_val(val, MAX6621_TEMP_INPUT_MIN,
                                  ^
    include/linux/minmax.h:137:32: note: expanded from macro 'clamp_val'
    #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
                                   ^
    include/linux/minmax.h:124:36: note: expanded from macro 'clamp_t'
    #define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
                                       ^
    include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
    #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                    ^
    include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                    __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), 
op))
                    ^
    include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                    __cmp(unique_x, unique_y, op); })
                    ^
    include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
    #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                             ^
    drivers/hwmon/max6621.c:323:10: note: Calling 'max6621_temp_mc2reg'
                            val = max6621_temp_mc2reg(val);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~
    drivers/hwmon/max6621.c:135:23: note: The result of the left shift 
is undefined because the left operand is negative
            return (val / 1000L) << MAX6621_REG_TEMP_SHIFT;
                   ~~~~~~~~~~~~~ ^
    Suppressed 8 warnings (8 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.
    Suppressed 9 warnings (8 in non-user code, 1 with check filters).
    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.
    Suppressed 9 warnings (8 in non-user code, 1 with check filters).
    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.
    Suppressed 9 warnings (8 in non-user code, 1 with check filters).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    12 warnings generated.
    drivers/nvme/target/fcloop.c:1226:3: warning: Value stored to 'ret' 
is never read [clang-analyzer-deadcode.DeadStores]
                    ret = -EINVAL;
                    ^     ~~~~~~~
    drivers/nvme/target/fcloop.c:1226:3: note: Value stored to 'ret' is 
never read
                    ret = -EINVAL;
                    ^     ~~~~~~~
    Suppressed 11 warnings (11 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.
    15 warnings generated.
>> drivers/ata/libata-core.c:2376: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(info, "LBA48 ");
                    ^~~~~~
    drivers/ata/libata-core.c:2376: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(info, "LBA48 ");
                    ^~~~~~
    drivers/ata/libata-core.c:2382: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(info, "LBA ");
                    ^~~~~~
    drivers/ata/libata-core.c:2382: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(info, "LBA ");
                    ^~~~~~
    drivers/ata/libata-core.c:5471:18: warning: Access to field 
'pio_mask' results in a dereference of a null pointer (loaded from 
variable 'pi') [clang-analyzer-core.NullDereference]
                    ap->pio_mask = pi->pio_mask;
                                   ^~
    drivers/ata/libata-core.c:5462:6: note: Assuming 'host' is non-null
            if (!host)
                ^~~~~
    drivers/ata/libata-core.c:5462:2: note: Taking false branch
            if (!host)
            ^
    drivers/ata/libata-core.c:5465:21: note: Null pointer value stored 
to 'pi'
            for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
                               ^~~~~~~~~
    drivers/ata/libata-core.c:5465:32: note: Assuming 'i' is < field 
'n_ports'
            for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
                                          ^~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5465:2: note: Loop condition is true. 
Entering loop body
            for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
            ^
    drivers/ata/libata-core.c:5468:7: note: Assuming the condition is false
                    if (ppi[j])
                        ^~~~~~
    drivers/ata/libata-core.c:5468:3: note: Taking false branch
                    if (ppi[j])
                    ^
    drivers/ata/libata-core.c:5471:18: note: Access to field 'pio_mask' 
results in a dereference of a null pointer (loaded from variable 'pi')
                    ap->pio_mask = pi->pio_mask;
                                   ^~
    drivers/ata/libata-core.c:5593:6: warning: Access to field 
'host_stop' results in a dereference of a null pointer (loaded from 
field 'ops') [clang-analyzer-core.NullDereference]
            if (host->ops->host_stop)
                ^
    drivers/ata/libata-core.c:5840:7: note: Calling 'ata_host_start'
            rc = ata_host_start(host);
                 ^~~~~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5576:6: note: Assuming the condition is false
            if (host->flags & ATA_HOST_STARTED)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5576:2: note: Taking false branch
            if (host->flags & ATA_HOST_STARTED)
            ^
    drivers/ata/libata-core.c:5581:14: note: Assuming 'i' is < field 
'n_ports'
            for (i = 0; i < host->n_ports; i++) {
                        ^~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5581:2: note: Loop condition is true. 
Entering loop body
            for (i = 0; i < host->n_ports; i++) {
            ^
    drivers/ata/libata-core.c:5586:7: note: Assuming field 'ops' is null
                    if (!host->ops && !ata_port_is_dummy(ap))
                        ^~~~~~~~~~
    drivers/ata/libata-core.c:5586:7: note: Assuming pointer value is null
                    if (!host->ops && !ata_port_is_dummy(ap))
                        ^~~~~~~~~~
    drivers/ata/libata-core.c:5586:7: note: Left side of '&&' is true
    drivers/ata/libata-core.c:5586:21: note: Assuming the condition is false
                    if (!host->ops && !ata_port_is_dummy(ap))
                                      ^~~~~~~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5586:3: note: Taking false branch
                    if (!host->ops && !ata_port_is_dummy(ap))
                    ^
    drivers/ata/libata-core.c:5589:7: note: Assuming field 'port_stop' 
is null
                    if (ap->ops->port_stop)
                        ^~~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5589:3: note: Taking false branch
                    if (ap->ops->port_stop)
                    ^
    drivers/ata/libata-core.c:5581:14: note: Assuming 'i' is >= field 
'n_ports'
            for (i = 0; i < host->n_ports; i++) {
                        ^~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:5581:2: note: Loop condition is false. 
Execution continues on line 5593
            for (i = 0; i < host->n_ports; i++) {
            ^
    drivers/ata/libata-core.c:5593:6: note: Access to field 'host_stop' 
results in a dereference of a null pointer (loaded from field 'ops')
            if (host->ops->host_stop)
                ^     ~~~
    Suppressed 11 warnings (11 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.
    8 warnings generated.
    include/linux/hid.h:1007:9: warning: Access to field 'name' results 
in a dereference of a null pointer (loaded from variable 'input') 
[clang-analyzer-core.NullDereference]
                                        input->name, c, type);
                                        ^
    drivers/hid/hid-lenovo.c:321:2: note: Control jumps to 'case 12544:' 
  at line 329
            switch (hdev->product) {
            ^
    drivers/hid/hid-lenovo.c:335:10: note: Calling 
'lenovo_input_mapping_scrollpoint'
                    return lenovo_input_mapping_scrollpoint(hdev, hi, field,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/hid/hid-lenovo.c:224:6: note: Assuming field 'hid' is equal 
to HID_GD_Z
            if (usage->hid == HID_GD_Z) {
                ^~~~~~~~~~~~~~~~~~~~~~
    drivers/hid/hid-lenovo.c:224:2: note: Taking true branch

vim +2376 drivers/ata/libata-core.c

818831c8b22f75 Christoph Hellwig 2017-06-04  2365  5622af0f73c977 Damien 
Le Moal    2021-08-02  2366  static int ata_dev_config_lba(struct 
ata_device *dev,
5622af0f73c977 Damien Le Moal    2021-08-02  2367  			      char *info, 
size_t infosz)
5622af0f73c977 Damien Le Moal    2021-08-02  2368  {
5622af0f73c977 Damien Le Moal    2021-08-02  2369  	const u16 *id = dev->id;
5622af0f73c977 Damien Le Moal    2021-08-02  2370  	int info_ofst;
5622af0f73c977 Damien Le Moal    2021-08-02  2371  5622af0f73c977 Damien 
Le Moal    2021-08-02  2372  	dev->flags |= ATA_DFLAG_LBA;
5622af0f73c977 Damien Le Moal    2021-08-02  2373  5622af0f73c977 Damien 
Le Moal    2021-08-02  2374  	if (ata_id_has_lba48(id)) {
5622af0f73c977 Damien Le Moal    2021-08-02  2375  		dev->flags |= 
ATA_DFLAG_LBA48;
5622af0f73c977 Damien Le Moal    2021-08-02 @2376  		strcpy(info, "LBA48 ");
5622af0f73c977 Damien Le Moal    2021-08-02  2377  5622af0f73c977 Damien 
Le Moal    2021-08-02  2378  		if (dev->n_sectors >= (1UL << 28) &&
5622af0f73c977 Damien Le Moal    2021-08-02  2379  		 
ata_id_has_flush_ext(id))
5622af0f73c977 Damien Le Moal    2021-08-02  2380  			dev->flags |= 
ATA_DFLAG_FLUSH_EXT;
5622af0f73c977 Damien Le Moal    2021-08-02  2381  	} else {
5622af0f73c977 Damien Le Moal    2021-08-02  2382  		strcpy(info, "LBA ");
5622af0f73c977 Damien Le Moal    2021-08-02  2383  	}
5622af0f73c977 Damien Le Moal    2021-08-02  2384  	info_ofst = 
strlen(info);
5622af0f73c977 Damien Le Moal    2021-08-02  2385  5622af0f73c977 Damien 
Le Moal    2021-08-02  2386  	/* config NCQ */
5622af0f73c977 Damien Le Moal    2021-08-02  2387  	return 
ata_dev_config_ncq(dev, info + info_ofst,
5622af0f73c977 Damien Le Moal    2021-08-02  2388  				  infosz - 
info_ofst);
5622af0f73c977 Damien Le Moal    2021-08-02  2389  }
5622af0f73c977 Damien Le Moal    2021-08-02  2390
---
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: 34103 bytes --]

[-- Attachment #3: Attached Message Part --]
[-- Type: text/plain, Size: 150 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


       reply	other threads:[~2021-08-03  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202108030231.7Ta42o7Q-lkp@intel.com>
2021-08-03  9:08 ` kernel test robot [this message]
2021-08-02  9:02 [PATCH 0/7] libata cleanups and improvements Damien Le Moal
2021-08-02  9:02 ` [PATCH 2/7] libata: cleanup ata_dev_configure() Damien Le Moal

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=b67cfc18-088e-aaa9-ca36-50c2251742cf@intel.com \
    --to=rong.a.chen@intel.com \
    --cc=axboe@kernel.dk \
    --cc=clang-built-linux@googlegroups.com \
    --cc=damien.lemoal@wdc.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /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;
as well as URLs for NNTP newsgroup(s).