[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdJ9n6Sm2HQYE_bfg-5vXceA3aG5aXOfCctxDjzhLVXpA@mail.gmail.com>
Date: Mon, 17 May 2021 10:04:59 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: Colin King <colin.king@...onical.com>,
Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>,
Srinivas Neeli <srinivas.neeli@...inx.com>,
Michal Simek <michal.simek@...inx.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] gpio: xilinx: Fix potential integer overflow on
shift of a u32 int
On Thu, May 13, 2021 at 1:04 PM David Laight <David.Laight@...lab.com> wrote:
> > From: Colin Ian King <colin.king@...onical.com>
> > @@ -99,7 +99,7 @@ static inline void xgpio_set_value32(unsigned long *map, int bit, u32 v)
> > const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5);
> >
> > map[index] &= ~(0xFFFFFFFFul << offset);
> > - map[index] |= v << offset;
> > + map[index] |= (unsigned long)v << offset;
> > }
>
> That code looks dubious on 32bit architectures.
>
> I don't have 02b3f84d9080 in any of my source trees.
Can you please be more specific on which code is dubious on 32-bit
arches and why?
> But that patch may itself be very dubious.
>
> Since the hardware requires explicit bits be set, relying
> on the bitmap functions seems pointless and possibly wrong.
> Clearly they cause additional problems because they use long[]
> and here the code needs u32[].
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists