Re: [PATCH v3] nvmem: check invalid number of bytes in nvmem_{read,write}()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

On Tue, Dec 11, 2018 at 11:55 AM Biju Das <biju.das@xxxxxxxxxxxxxx> wrote:
> > Subject: Re: [PATCH v3] nvmem: check invalid number of bytes in
> > nvmem_{read,write}()
> >
> > After applying this patch I get below errors with W=1 C=1
> >
> > On 11/12/18 09:24, Biju Das wrote:
> > > +if (unlikely(check_add_overflow(bytes, offset, &new_bytes)))
> > > +return -EOVERFLOW;
> > >   drivers/nvmem/core.c:82:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:82:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:113:13: error: incompatible types in comparison
> > expression (different type sizes)
> > drivers/nvmem/core.c:113:13: error: incompatible types in comparison
> > expression (different type sizes)
>
> I was trying with arm32 toolchain and compiler happy. Now tried with Arm64 toolchain, it provides a warning and the below typecast fixed the issue.
> if (unlikely(check_add_overflow(bytes, (size_t)offset, &new_bytes)))
>
> Does typecasting to (size_t)  fixed the issue in your environment? Please let  me know.

That's a side-effect of offset not being loff_t...
I think that should be fixed first, else you will forget about
removing the cast later
("casts are evil").

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux