Hi Srini,
Thanks for the feedback.
> Subject: Re: [PATCH v2] nvmem: check invalid number of bytes in
> nvmem_{read,write}()
>
>
>
> On 10/12/18 15:28, Biju Das wrote:
> > +/* Stop the user from writing */
> > +if (offset >= nvmem->size)
> > +return -ENOSPC;
> > +
> This should be "return -EFBIG" to make utilities like dd or sh happy.
>
> Look at 38b0774c0598c ("nvmem: core: return EFBIG on out-of-range
> write") for more info.
return -ENOSPC also make dd or sh happy. Please let me know which is
appropriate by the below results. Based on your feedback, If needed, I can send
a patch with "return -EFBIG"
With -ENOSPC
------------
dd if=1.bin of=/sys/bus/nvmem/devices/pcf85x63-0/nvmem bs=1 count=2
dd: writing '/sys/bus/nvmem/devices/pcf85x63-0/nvmem': No space left on device
2+0 records in
1+0 records out
echo "1234" > /sys/bus/nvmem/devices/pcf85x63-0/nvmem
-sh: echo: write error: No space left on device
with -EFBIG
------------
dd if=1.bin of=/sys/bus/nvmem/devices/pcf85x63-0/nvmem bs=1 count
dd: writing '/sys/bus/nvmem/devices/pcf85x63-0/nvmem': File too large
2+0 records in
1+0 records out
echo "1234" > /sys/bus/nvmem/devices/pcf85x63-0/nvmem
-sh: echo: write error: File too large
Regards,
Biju
[https://www2.renesas.eu/media/email/unicef.jpg]
This Christmas, instead of sending out cards, Renesas Electronics Europe have
decided to support Unicef with a donation. For further details click
here<https://www.unicef.org/> to find out about the valuable work they do,
helping children all over the world.
We would like to take this opportunity to wish you a Merry Christmas and a
prosperous New Year.
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End,
Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered
No. 04586709.