From: Syed Nayyar Waris <syednwaris@gmail.com>
To: kernel test robot <lkp@intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Andrew Morton <akpm@linux-foundation.org>,
kbuild-all@lists.01.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
William Breathitt Gray <vilhelm.gray@gmail.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Michal Simek <michal.simek@xilinx.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v8 4/4] gpio: xilinx: Utilize for_each_set_clump macro
Date: Tue, 16 Jun 2020 11:27:18 +0530 [thread overview]
Message-ID: <CACG_h5oiA8mDpTjtyGFYR4eptbxppN9tq+2wUj8T1hsbZ5h47A@mail.gmail.com> (raw)
In-Reply-To: <202006160420.iatdr9ab%lkp@intel.com>
On Tue, Jun 16, 2020 at 1:39 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Syed,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on 444fc5cde64330661bf59944c43844e7d4c2ccd8]
>
> url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20200615-205729
> base: 444fc5cde64330661bf59944c43844e7d4c2ccd8
> config: sparc64-randconfig-s032-20200615 (attached as .config)
> compiler: sparc64-linux-gcc (GCC) 9.3.0
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.2-rc1-3-g55607964-dirty
> # save the attached .config to linux build tree
> make W=1 C=1 ARCH=sparc64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>
> 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 >>)
>
> >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type unsigned long
> >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type unsigned long
> include/linux/bitmap.h:594:63: sparse: sparse: shift too big (64) for type unsigned long
> >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type unsigned long
> >> include/linux/bitmap.h:638:17: sparse: sparse: invalid access past the end of 'old' (8 8)
>
> vim +639 include/linux/bitmap.h
>
> 169c474fb22d8a William Breathitt Gray 2019-12-04 613
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 614 /**
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 615 * bitmap_set_value - set n-bit value within a memory region
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 616 * @map: address to the bitmap memory region
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 617 * @value: value of nbits
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 618 * @start: bit offset of the n-bit value
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 619 * @nbits: size of value in bits
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 620 */
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 621 static inline void bitmap_set_value(unsigned long *map,
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 622 unsigned long value,
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 623 unsigned long start, unsigned long nbits)
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 624 {
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 625 const size_t index = BIT_WORD(start);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 626 const unsigned long offset = start % BITS_PER_LONG;
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 627 const unsigned long ceiling = roundup(start + 1, BITS_PER_LONG);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 628 const unsigned long space = ceiling - start;
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 629
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 630 value &= GENMASK(nbits - 1, 0);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 631
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 632 if (space >= nbits) {
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 633 map[index] &= ~(GENMASK(nbits + offset - 1, offset));
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 634 map[index] |= value << offset;
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 635 } else {
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 636 map[index] &= ~BITMAP_FIRST_WORD_MASK(start);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 637 map[index] |= value << offset;
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 @638 map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 @639 map[index + 1] |= (value >> space);
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 640 }
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 641 }
> 803024b6c8a375 Syed Nayyar Waris 2020-06-15 642
Regarding the compilation warning reported above:
"sparse: shift too big (64) for type unsigned long" at line 639
"sparse: invalid access past the end of 'old' (8 8)" at line 638
Kindly refer to the code above, at these line numbers.
I am in the process of fixing this warning. But what would be the fix
? At the moment can't think of a code-fix to make the compilation
warning disappear (specially at line 639). Can anyone please explain
to me the meaning of the compilation warning more deeply?
By the way, this warning was not reported in (earlier) v7 of the patchset.
Regards
Syed Nayyar Waris
next prev parent reply other threads:[~2020-06-16 5:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 12:50 [PATCH v8 0/4] Introduce the for_each_set_clump macro Syed Nayyar Waris
2020-06-15 12:51 ` [PATCH v8 1/4] bitops: " Syed Nayyar Waris
2020-06-15 13:56 ` Andy Shevchenko
2020-06-15 16:47 ` kernel test robot
2020-06-16 8:14 ` Andy Shevchenko
2020-06-20 13:45 ` Syed Nayyar Waris
2020-06-20 23:41 ` Syed Nayyar Waris
2020-06-17 8:00 ` kernel test robot
2020-06-15 12:52 ` [PATCH v8 2/4] lib/test_bitmap.c: Add for_each_set_clump test cases Syed Nayyar Waris
2020-06-15 12:53 ` [PATCH v8 3/4] gpio: thunderx: Utilize for_each_set_clump macro Syed Nayyar Waris
2020-06-15 12:54 ` [PATCH v8 4/4] gpio: xilinx: " Syed Nayyar Waris
2020-06-15 20:09 ` kernel test robot
2020-06-16 5:57 ` Syed Nayyar Waris [this message]
2020-06-19 14:26 ` Luc Van Oostenryck
2020-06-19 7:00 ` Syed Nayyar Waris
2020-06-19 8:38 ` Andy Shevchenko
2020-06-19 9:05 ` Andy Shevchenko
2020-06-19 19:17 ` Robin Murphy
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=CACG_h5oiA8mDpTjtyGFYR4eptbxppN9tq+2wUj8T1hsbZ5h47A@mail.gmail.com \
--to=syednwaris@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=kbuild-all@lists.01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=michal.simek@xilinx.com \
--cc=vilhelm.gray@gmail.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).