From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, "Rafał Miłecki" <rafal@milecki.pl>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org,
Miquel Raynal <miquel.raynal@bootlin.com>
Subject: drivers/mtd/parsers/ofpart_bcm4908.c:41 bcm4908_partitions_fw_offset() warn: should 'offset << 10' be a 64 bit type?
Date: Mon, 6 Dec 2021 16:18:10 +0300 [thread overview]
Message-ID: <202112040342.AvFc4SDJ-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5f58da2befa58edf3a70b91ed87ed9bf77f1e70e
commit: bb17230c61a6424b622e92006ec52ba23aa5a967 mtd: parsers: ofpart: support BCM4908 fixed partitions
date: 9 months ago
config: nios2-randconfig-m031-20211202 (https://download.01.org/0day-ci/archive/20211204/202112040342.AvFc4SDJ-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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
bb17230c61a642 Rafał Miłecki 2021-03-01 17 static long long bcm4908_partitions_fw_offset(void)
^^^^^^^^^
This is long long.
bb17230c61a642 Rafał Miłecki 2021-03-01 18 {
bb17230c61a642 Rafał Miłecki 2021-03-01 19 struct device_node *root;
bb17230c61a642 Rafał Miłecki 2021-03-01 20 struct property *prop;
bb17230c61a642 Rafał Miłecki 2021-03-01 21 const char *s;
bb17230c61a642 Rafał Miłecki 2021-03-01 22
bb17230c61a642 Rafał Miłecki 2021-03-01 23 root = of_find_node_by_path("/");
bb17230c61a642 Rafał Miłecki 2021-03-01 24 if (!root)
bb17230c61a642 Rafał Miłecki 2021-03-01 25 return -ENOENT;
bb17230c61a642 Rafał Miłecki 2021-03-01 26
bb17230c61a642 Rafał Miłecki 2021-03-01 27 of_property_for_each_string(root, "brcm_blparms", prop, s) {
bb17230c61a642 Rafał Miłecki 2021-03-01 28 size_t len = strlen(BLPARAMS_FW_OFFSET);
bb17230c61a642 Rafał Miłecki 2021-03-01 29 unsigned long offset;
bb17230c61a642 Rafał Miłecki 2021-03-01 30 int err;
bb17230c61a642 Rafał Miłecki 2021-03-01 31
bb17230c61a642 Rafał Miłecki 2021-03-01 32 if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=')
bb17230c61a642 Rafał Miłecki 2021-03-01 33 continue;
bb17230c61a642 Rafał Miłecki 2021-03-01 34
bb17230c61a642 Rafał Miłecki 2021-03-01 35 err = kstrtoul(s + len + 1, 0, &offset);
bb17230c61a642 Rafał Miłecki 2021-03-01 36 if (err) {
bb17230c61a642 Rafał Miłecki 2021-03-01 37 pr_err("failed to parse %s\n", s + len + 1);
bb17230c61a642 Rafał Miłecki 2021-03-01 38 return err;
bb17230c61a642 Rafał Miłecki 2021-03-01 39 }
bb17230c61a642 Rafał Miłecki 2021-03-01 40
bb17230c61a642 Rafał Miłecki 2021-03-01 @41 return offset << 10;
^^^^^^^^^^^^
So this should be long long. Although 32bit systems are not really
common in real life any more...
bb17230c61a642 Rafał Miłecki 2021-03-01 42 }
bb17230c61a642 Rafał Miłecki 2021-03-01 43
bb17230c61a642 Rafał Miłecki 2021-03-01 44 return -ENOENT;
bb17230c61a642 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
next reply other threads:[~2021-12-06 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 13:18 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-14 9:57 drivers/mtd/parsers/ofpart_bcm4908.c:41 bcm4908_partitions_fw_offset() warn: should 'offset << 10' be a 64 bit type? Dan Carpenter
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=202112040342.AvFc4SDJ-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
/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