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: <202109121458.WnEMVBBo-lkp@intel.com>
Date:   Tue, 14 Sep 2021 12:57:13 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Rafał Miłecki <rafal@...ecki.pl>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Miquel Raynal <miquel.raynal@...tlin.com>
Subject: drivers/mtd/parsers/ofpart_bcm4908.c:41
 bcm4908_partitions_fw_offset() warn: should 'offset << 10' be a 64 bit type?

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   78e709522d2c012cb0daad2e668506637bffb7c2
commit: bb17230c61a6424b622e92006ec52ba23aa5a967 mtd: parsers: ofpart: support BCM4908 fixed partitions
config: parisc-randconfig-m031-20210912 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/mtd/parsers/ofpart_bcm4908.c:41 bcm4908_partitions_fw_offset() warn: should 'offset << 10' be a 64 bit type?

vim +41 drivers/mtd/parsers/ofpart_bcm4908.c

bb17230c61a6424b Rafał Miłecki 2021-03-01  17  static long long bcm4908_partitions_fw_offset(void)
bb17230c61a6424b Rafał Miłecki 2021-03-01  18  {
bb17230c61a6424b Rafał Miłecki 2021-03-01  19  	struct device_node *root;
bb17230c61a6424b Rafał Miłecki 2021-03-01  20  	struct property *prop;
bb17230c61a6424b Rafał Miłecki 2021-03-01  21  	const char *s;
bb17230c61a6424b Rafał Miłecki 2021-03-01  22  
bb17230c61a6424b Rafał Miłecki 2021-03-01  23  	root = of_find_node_by_path("/");
bb17230c61a6424b Rafał Miłecki 2021-03-01  24  	if (!root)
bb17230c61a6424b Rafał Miłecki 2021-03-01  25  		return -ENOENT;
bb17230c61a6424b Rafał Miłecki 2021-03-01  26  
bb17230c61a6424b Rafał Miłecki 2021-03-01  27  	of_property_for_each_string(root, "brcm_blparms", prop, s) {
bb17230c61a6424b Rafał Miłecki 2021-03-01  28  		size_t len = strlen(BLPARAMS_FW_OFFSET);
bb17230c61a6424b Rafał Miłecki 2021-03-01  29  		unsigned long offset;
bb17230c61a6424b Rafał Miłecki 2021-03-01  30  		int err;
bb17230c61a6424b Rafał Miłecki 2021-03-01  31  
bb17230c61a6424b Rafał Miłecki 2021-03-01  32  		if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=')
bb17230c61a6424b Rafał Miłecki 2021-03-01  33  			continue;
bb17230c61a6424b Rafał Miłecki 2021-03-01  34  
bb17230c61a6424b Rafał Miłecki 2021-03-01  35  		err = kstrtoul(s + len + 1, 0, &offset);
bb17230c61a6424b Rafał Miłecki 2021-03-01  36  		if (err) {
bb17230c61a6424b Rafał Miłecki 2021-03-01  37  			pr_err("failed to parse %s\n", s + len + 1);
bb17230c61a6424b Rafał Miłecki 2021-03-01  38  			return err;
bb17230c61a6424b Rafał Miłecki 2021-03-01  39  		}
bb17230c61a6424b Rafał Miłecki 2021-03-01  40  
bb17230c61a6424b Rafał Miłecki 2021-03-01 @41  		return offset << 10;

There is a kind of mismatch between offset which is unsigned long and
bcm4908_partitions_fw_offset() which returns u64.

bb17230c61a6424b Rafał Miłecki 2021-03-01  42  	}
bb17230c61a6424b Rafał Miłecki 2021-03-01  43  
bb17230c61a6424b Rafał Miłecki 2021-03-01  44  	return -ENOENT;
bb17230c61a6424b Rafał Miłecki 2021-03-01  45  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ