From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: kernel test robot <lkp@intel.com>, <kbuild-all@lists.01.org>,
<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>
Subject: Re: drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression
Date: Tue, 10 Nov 2020 14:38:27 +0300 [thread overview]
Message-ID: <20201110113827.hl5i27cpl6exo3md@mobilestation> (raw)
In-Reply-To: <202011021254.XC70BaQT-lkp@intel.com>
Hello Miquel,
A situation noted by the warning below won't cause any problem because
the casting is done to a non-dereferenced variable. It is utilized
as a pointer bias later in that function. Shall we just ignore the
warning or still fix it somehow?
-Sergey
On Mon, Nov 02, 2020 at 12:42:57PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 3cea11cd5e3b00d91caf0b4730194039b45c5891
> commit: b3e79e7682e075326df8041b826b03453acacd0a mtd: physmap: Add Baikal-T1 physically mapped ROM support
> date: 4 weeks ago
> config: sparc64-randconfig-s032-20201031 (attached as .config)
> compiler: sparc64-linux-gcc (GCC) 9.3.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.3-76-gf680124b-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b3e79e7682e075326df8041b826b03453acacd0a
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout b3e79e7682e075326df8041b826b03453acacd0a
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> "sparse warnings: (new ones prefixed by >>)"
> >> drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression
>
> vim +/__iomem +78 drivers/mtd/maps/physmap-bt1-rom.c
>
> 57
> 58 static void __xipram bt1_rom_map_copy_from(struct map_info *map,
> 59 void *to, unsigned long from,
> 60 ssize_t len)
> 61 {
> 62 void __iomem *src = map->virt + from;
> 63 ssize_t shift, chunk;
> 64 u32 data;
> 65
> 66 if (len <= 0 || from >= map->size)
> 67 return;
> 68
> 69 /* Make sure we don't go over the map limit. */
> 70 len = min_t(ssize_t, map->size - from, len);
> 71
> 72 /*
> 73 * Since requested data size can be pretty big we have to implement
> 74 * the copy procedure as optimal as possible. That's why it's split
> 75 * up into the next three stages: unaligned head, aligned body,
> 76 * unaligned tail.
> 77 */
> > 78 shift = (ssize_t)src & 0x3;
> 79 if (shift) {
> 80 chunk = min_t(ssize_t, 4 - shift, len);
> 81 data = readl_relaxed(src - shift);
> 82 memcpy(to, &data + shift, chunk);
> 83 src += chunk;
> 84 to += chunk;
> 85 len -= chunk;
> 86 }
> 87
> 88 while (len >= 4) {
> 89 data = readl_relaxed(src);
> 90 memcpy(to, &data, 4);
> 91 src += 4;
> 92 to += 4;
> 93 len -= 4;
> 94 }
> 95
> 96 if (len) {
> 97 data = readl_relaxed(src);
> 98 memcpy(to, &data, len);
> 99 }
> 100 }
> 101
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next prev parent reply other threads:[~2020-11-10 11:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 4:42 drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression kernel test robot
2020-11-10 11:38 ` Serge Semin [this message]
2020-11-10 15:35 ` Miquel Raynal
2020-11-11 19:22 ` Serge Semin
2020-11-12 8:27 ` Miquel Raynal
2020-11-12 11:20 ` Serge Semin
2020-11-12 15:00 ` Vignesh Raghavendra
2020-11-12 15:27 ` Serge Semin
2020-11-12 15:43 ` Miquel Raynal
2020-11-12 16:10 ` Serge Semin
2020-11-12 16:15 ` Miquel Raynal
2020-11-12 16:21 ` Serge Semin
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=20201110113827.hl5i27cpl6exo3md@mobilestation \
--to=sergey.semin@baikalelectronics.ru \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=lkp@intel.com \
--cc=miquel.raynal@bootlin.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).