lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <42415a62-9161-5f0e-4558-5e9b281941a7@intel.com>
Date:   Wed, 28 Jul 2021 08:29:14 +0800
From:   kernel test robot <rong.a.chen@...el.com>
To:     wengjianfeng <wengjianfeng@...ong.com>
Cc:     kbuild-all@...ts.01.org, netdev@...r.kernel.org,
        Krzysztof Kozlowski <krzk@...nel.org>
Subject: [net-next:master 64/75] drivers/nfc/s3fwrn5/firmware.c:424:3:
 warning: 3rd function call argument is an uninitialized value
 [clang-analyzer-core.CallAndMessage]


tree: 
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   268ca4129d8da764fdf72916f762a1145c6ea743
commit: a0302ff5906ac021d1d79cecd7b710970e40e588 [64/75] nfc: s3fwrn5: 
remove unnecessary label
:::::: branch date: 6 hours ago
:::::: commit date: 17 hours ago
config: x86_64-randconfig-c001-20210726 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
c63dbd850182797bc4b76124d08e1c320ab2365d)
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://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=a0302ff5906ac021d1d79cecd7b710970e40e588
         git remote add net-next 
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
         git fetch --no-tags net-next master
         git checkout a0302ff5906ac021d1d79cecd7b710970e40e588
         # 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@...el.com>


clang-analyzer warnings: (new ones prefixed by >>)
    drivers/power/supply/bq256xx_charger.c:275:8: warning: Excessive 
padding in 'struct bq256xx_chip_info' (11 padding bytes, where 3 is 
optimal).    Optimal fields order:    bq256xx_regmap_config, 
bq256xx_get_ichg,    bq256xx_get_iindpm,    bq256xx_get_vbatreg, 
bq256xx_get_iterm,    bq256xx_get_iprechg,    bq256xx_get_vindpm, 
bq256xx_set_ichg,    bq256xx_set_iindpm,    bq256xx_set_vbatreg, 
bq256xx_set_iterm,    bq256xx_set_iprechg,    bq256xx_set_vindpm, 
model_id,    bq256xx_def_ichg,    bq256xx_def_iindpm, 
bq256xx_def_vbatreg,    bq256xx_def_iterm,    bq256xx_def_iprechg, 
bq256xx_def_vindpm,    bq256xx_max_ichg,    bq256xx_max_vbatreg, 
has_usb_detect,    consider reordering the fields or adding explicit 
padding members [clang-analyzer-optin.performance.Padding]
    struct bq256xx_chip_info {
    ~~~~~~~^~~~~~~~~~~~~~~~~~~
    drivers/power/supply/bq256xx_charger.c:275:8: note: Excessive 
padding in 'struct bq256xx_chip_info' (11 padding bytes, where 3 is 
optimal). Optimal fields order: bq256xx_regmap_config, bq256xx_get_ichg, 
bq256xx_get_iindpm, bq256xx_get_vbatreg, bq256xx_get_iterm, 
bq256xx_get_iprechg, bq256xx_get_vindpm, bq256xx_set_ichg, 
bq256xx_set_iindpm, bq256xx_set_vbatreg, bq256xx_set_iterm, 
bq256xx_set_iprechg, bq256xx_set_vindpm, model_id, bq256xx_def_ichg, 
bq256xx_def_iindpm, bq256xx_def_vbatreg, bq256xx_def_iterm, 
bq256xx_def_iprechg, bq256xx_def_vindpm, bq256xx_max_ichg, 
bq256xx_max_vbatreg, has_usb_detect, consider reordering the fields or 
adding explicit padding members
    struct bq256xx_chip_info {
    ~~~~~~~^~~~~~~~~~~~~~~~~~~
    drivers/power/supply/bq256xx_charger.c:1521:2: warning: Value stored 
to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
            ret = regmap_update_bits(bq->regmap, BQ256XX_CHARGER_CONTROL_1,
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/power/supply/bq256xx_charger.c:1521:2: note: Value stored to 
'ret' is never read
            ret = regmap_update_bits(bq->regmap, BQ256XX_CHARGER_CONTROL_1,
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    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.
    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.
    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.
    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.
    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.
    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.
    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/char/mem.c:690:21: warning: Excessive padding in 'struct 
memdev' (10 padding bytes, where 2 is optimal).    Optimal fields order: 
    name,    fops,    fmode,    mode,    consider reordering the fields 
or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
    static const struct memdev {
                 ~~~~~~~^~~~~~~~
    drivers/char/mem.c:690:21: note: Excessive padding in 'struct 
memdev' (10 padding bytes, where 2 is optimal). Optimal fields order: 
name, fops, fmode, mode, consider reordering the fields or adding 
explicit padding members
    static const struct memdev {
                 ~~~~~~~^~~~~~~~
    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.
    Suppressed 4 warnings (3 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.
    5 warnings generated.
>> drivers/nfc/s3fwrn5/firmware.c:424:3: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
                    dev_err(&fw_info->ndev->nfc_dev->dev,
                    ^
    include/linux/dev_printk.h:112:2: note: expanded from macro 'dev_err'
            _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
            ^                             ~~~~~~~~~~~
    drivers/nfc/s3fwrn5/firmware.c:416:2: note: 'ret' declared without 
an initial value
            int ret;
            ^~~~~~~
    drivers/nfc/s3fwrn5/firmware.c:423:6: note: Calling 'IS_ERR'
            if (IS_ERR(tfm)) {
                ^~~~~~~~~~~
    include/linux/err.h:36:9: note: Assuming the condition is true
            return IS_ERR_VALUE((unsigned long)ptr);
                   ^
    include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
    #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= 
(unsigned long)-MAX_ERRNO)
 
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
    # define unlikely(x)    __builtin_expect(!!(x), 0)
                                                ^
    include/linux/err.h:36:2: note: Returning the value 1, which 
participates in a condition later
            return IS_ERR_VALUE((unsigned long)ptr);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/nfc/s3fwrn5/firmware.c:423:6: note: Returning from 'IS_ERR'
            if (IS_ERR(tfm)) {
                ^~~~~~~~~~~
    drivers/nfc/s3fwrn5/firmware.c:423:2: note: Taking true branch
            if (IS_ERR(tfm)) {
            ^
    drivers/nfc/s3fwrn5/firmware.c:424:3: note: 3rd function call 
argument is an uninitialized value
                    dev_err(&fw_info->ndev->nfc_dev->dev,
                    ^
    include/linux/dev_printk.h:112:2: note: expanded from macro 'dev_err'
            _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
            ^                             ~~~~~~~~~~~
    drivers/nfc/s3fwrn5/firmware.c:479: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(fw_info->fw_name, fw_name);
            ^~~~~~
    drivers/nfc/s3fwrn5/firmware.c:479: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(fw_info->fw_name, fw_name);
            ^~~~~~
    Suppressed 3 warnings (2 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.
    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.
    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.
    4 warnings generated.
    Suppressed 4 warnings (4 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.
    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.
    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.
    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.
    4 warnings generated.
    Suppressed 4 warnings (4 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.
    Suppressed 4 warnings (4 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.
    5 warnings generated.
    Suppressed 5 warnings (4 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.

vim +424 drivers/nfc/s3fwrn5/firmware.c

c04c674fadeb4a Robert Baldyga 2015-08-20  409  c04c674fadeb4a Robert 
Baldyga 2015-08-20  410  int s3fwrn5_fw_download(struct s3fwrn5_fw_info 
*fw_info)
c04c674fadeb4a Robert Baldyga 2015-08-20  411  {
c04c674fadeb4a Robert Baldyga 2015-08-20  412  	struct s3fwrn5_fw_image 
*fw = &fw_info->fw;
c04c674fadeb4a Robert Baldyga 2015-08-20  413  	u8 
hash_data[SHA1_DIGEST_SIZE];
4a31340b36302d Herbert Xu     2016-01-24  414  	struct crypto_shash *tfm;
c04c674fadeb4a Robert Baldyga 2015-08-20  415  	u32 image_size, off;
c04c674fadeb4a Robert Baldyga 2015-08-20  416  	int ret;
c04c674fadeb4a Robert Baldyga 2015-08-20  417  c04c674fadeb4a Robert 
Baldyga 2015-08-20  418  	image_size = fw_info->sector_size * 
fw->image_sectors;
c04c674fadeb4a Robert Baldyga 2015-08-20  419  c04c674fadeb4a Robert 
Baldyga 2015-08-20  420  	/* Compute SHA of firmware data */
c04c674fadeb4a Robert Baldyga 2015-08-20  421  4a31340b36302d Herbert Xu 
     2016-01-24  422  	tfm = crypto_alloc_shash("sha1", 0, 0);
4a31340b36302d Herbert Xu     2016-01-24  423  	if (IS_ERR(tfm)) {
4a31340b36302d Herbert Xu     2016-01-24 @424  	 
dev_err(&fw_info->ndev->nfc_dev->dev,
4a31340b36302d Herbert Xu     2016-01-24  425  			"Cannot allocate shash 
(code=%d)\n", ret);
a0302ff5906ac0 wengjianfeng   2021-07-26  426  		return PTR_ERR(tfm);
4a31340b36302d Herbert Xu     2016-01-24  427  	}
4a31340b36302d Herbert Xu     2016-01-24  428  96a5aa721df8e7 Eric 
Biggers   2020-05-01  429  	ret = crypto_shash_tfm_digest(tfm, 
fw->image, image_size, hash_data);
4a31340b36302d Herbert Xu     2016-01-24  430  4a31340b36302d Herbert Xu 
     2016-01-24  431  	crypto_free_shash(tfm);
4a31340b36302d Herbert Xu     2016-01-24  432  	if (ret) {
4a31340b36302d Herbert Xu     2016-01-24  433  	 
dev_err(&fw_info->ndev->nfc_dev->dev,
4a31340b36302d Herbert Xu     2016-01-24  434  			"Cannot compute hash 
(code=%d)\n", ret);
a0302ff5906ac0 wengjianfeng   2021-07-26  435  		return ret;
4a31340b36302d Herbert Xu     2016-01-24  436  	}
c04c674fadeb4a Robert Baldyga 2015-08-20  437  c04c674fadeb4a Robert 
Baldyga 2015-08-20  438  	/* Firmware update process */
c04c674fadeb4a Robert Baldyga 2015-08-20  439  c04c674fadeb4a Robert 
Baldyga 2015-08-20  440  	dev_info(&fw_info->ndev->nfc_dev->dev,
c04c674fadeb4a Robert Baldyga 2015-08-20  441  		"Firmware update: 
%s\n", fw_info->fw_name);
c04c674fadeb4a Robert Baldyga 2015-08-20  442  c04c674fadeb4a Robert 
Baldyga 2015-08-20  443  	ret = s3fwrn5_fw_enter_update_mode(fw_info, 
hash_data,
c04c674fadeb4a Robert Baldyga 2015-08-20  444  		SHA1_DIGEST_SIZE, 
fw_info->sig, fw_info->sig_size);
c04c674fadeb4a Robert Baldyga 2015-08-20  445  	if (ret < 0) {
c04c674fadeb4a Robert Baldyga 2015-08-20  446  	 
dev_err(&fw_info->ndev->nfc_dev->dev,
c04c674fadeb4a Robert Baldyga 2015-08-20  447  			"Unable to enter 
update mode\n");
a0302ff5906ac0 wengjianfeng   2021-07-26  448  		return ret;
c04c674fadeb4a Robert Baldyga 2015-08-20  449  	}
c04c674fadeb4a Robert Baldyga 2015-08-20  450  c04c674fadeb4a Robert 
Baldyga 2015-08-20  451  	for (off = 0; off < image_size; off += 
fw_info->sector_size) {
c04c674fadeb4a Robert Baldyga 2015-08-20  452  		ret = 
s3fwrn5_fw_update_sector(fw_info,
c04c674fadeb4a Robert Baldyga 2015-08-20  453  			fw_info->base_addr + 
off, fw->image + off);
c04c674fadeb4a Robert Baldyga 2015-08-20  454  		if (ret < 0) {
c04c674fadeb4a Robert Baldyga 2015-08-20  455  		 
dev_err(&fw_info->ndev->nfc_dev->dev,
c04c674fadeb4a Robert Baldyga 2015-08-20  456  				"Firmware update 
error (code=%d)\n", ret);
a0302ff5906ac0 wengjianfeng   2021-07-26  457  			return ret;
c04c674fadeb4a Robert Baldyga 2015-08-20  458  		}
c04c674fadeb4a Robert Baldyga 2015-08-20  459  	}
c04c674fadeb4a Robert Baldyga 2015-08-20  460  c04c674fadeb4a Robert 
Baldyga 2015-08-20  461  	ret = s3fwrn5_fw_complete_update_mode(fw_info);
c04c674fadeb4a Robert Baldyga 2015-08-20  462  	if (ret < 0) {
c04c674fadeb4a Robert Baldyga 2015-08-20  463  	 
dev_err(&fw_info->ndev->nfc_dev->dev,
c04c674fadeb4a Robert Baldyga 2015-08-20  464  			"Unable to complete 
update mode\n");
a0302ff5906ac0 wengjianfeng   2021-07-26  465  		return ret;
c04c674fadeb4a Robert Baldyga 2015-08-20  466  	}
c04c674fadeb4a Robert Baldyga 2015-08-20  467  c04c674fadeb4a Robert 
Baldyga 2015-08-20  468  	dev_info(&fw_info->ndev->nfc_dev->dev,
c04c674fadeb4a Robert Baldyga 2015-08-20  469  		"Firmware update: 
success\n");
c04c674fadeb4a Robert Baldyga 2015-08-20  470  c04c674fadeb4a Robert 
Baldyga 2015-08-20  471  	return ret;
c04c674fadeb4a Robert Baldyga 2015-08-20  472  }
c04c674fadeb4a Robert Baldyga 2015-08-20  473
:::::: The code at line 424 was first introduced by commit
:::::: 4a31340b36302d46207c6bb54d103d9fb568e916 nfc: s3fwrn5: Use shash

:::::: TO: Herbert Xu <herbert@...dor.apana.org.au>
:::::: CC: Herbert Xu <herbert@...dor.apana.org.au>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


Download attachment ".config.gz" of type "application/gzip" (33626 bytes)

View attachment "Attached Message Part" of type "text/plain" (151 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ