Hi Biju, On Fri, Dec 7, 2018 at 11:16 AM Biju Das <biju.das@xxxxxxxxxxxxxx> wrote: > > Subject: Re: [PATCH v3 2/4] rtc: pcf85363: Add support for NXP pcf85263 rtc > > On Fri, Dec 7, 2018 at 10:34 AM Biju Das <biju.das@xxxxxxxxxxxxxx> wrote: > > > > Subject: Re: [PATCH v3 2/4] rtc: pcf85363: Add support for NXP > > > > pcf85263 rtc > > > > I think it is probably better to ensure the nvmem core never passes > > > > an invalid number of bytes. All the ther RTC drivers make that > > assumption. > > > > > > In that case, I will do following checks in > > > nvmem_device_{read,write}() before calling nvmem_reg_{read,write}(), > > > > > > nvmem_device_read > > > > > > /* Stop the user from reading */ > > > if (offset >= nvmem->size) > > > return 0; > > > > > > if (bytes == 0) > > > return -EINVAL; > > > > Why not 0? > > Ok. Will merge with above check. > > if ((offset >= nvmem->size) && (bytes == 0)) "||" ;-) > return 0; 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