On Wed, Oct 28, 2020 at 1:42 AM Jakub Kicinski wrote:
>
> On Mon, 26 Oct 2020 22:29:48 +0100 Arnd Bergmann wrote:
> > From: Arnd Bergmann
> >
> > Building a "W=1" kernel with clang produces a warning about
> > suspicous pointer arithmetic:
> >
> > drivers/atm/horizon.c:1844:52: warning: performin
On Mon, 26 Oct 2020 22:29:48 +0100 Arnd Bergmann wrote:
> From: Arnd Bergmann
>
> Building a "W=1" kernel with clang produces a warning about
> suspicous pointer arithmetic:
>
> drivers/atm/horizon.c:1844:52: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnu
On Tue, Oct 27, 2020 at 6:24 AM Arnd Bergmann wrote:
>
> Ah, of course. I had looked up the types but mixed up the memmap
> and HDW definitions, but then got confused trying to understand the
> logic in wr_mem() that operates on bytes but expands them into
> multiples of 4.
I think wr_mem() doesn
On Tue, Oct 27, 2020 at 5:02 AM Xie He wrote:
>
> On Mon, Oct 26, 2020 at 8:56 PM Xie He wrote:
> >
> > > - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
> > > + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1);
> > > ++mem)
> >
> > Note that these two lines are
On Mon, Oct 26, 2020 at 8:56 PM Xie He wrote:
>
> > - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
> > + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem)
>
> Note that these two lines are semantically different. In the first line,
> "+ 1" moves the pointe
> - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
> + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem)
Note that these two lines are semantically different. In the first line,
"+ 1" moves the pointer by (sizeof memmap) bytes. However in the second
line, "+
From: Arnd Bergmann
Building a "W=1" kernel with clang produces a warning about
suspicous pointer arithmetic:
drivers/atm/horizon.c:1844:52: warning: performing pointer arithmetic
on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
for (mem = (HDW *) memmap; mem < (HDW *) (mem