nvmem: core: return EFBIG on out-of-range write
authorGuy Shapiro <guy.shapiro@mobi-wize.com>
Mon, 11 Sep 2017 09:00:11 +0000 (11:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Sep 2017 14:12:26 +0000 (16:12 +0200)
commit38b0774c0598c7a54b8499d18c2b764c35dc94ab
tree75072e17f1b771355a271c3e0289801da5b5e773
parent93dc1774d2a4c7a298d5cdf78cc8acdcb7b1428d
nvmem: core: return EFBIG on out-of-range write

When writing data that exceeds the nvmem size to a nvmem sysfs file
using the sh redirection operator >, the shell hangs, trying to
write the out-of-range bytes endlessly.

Fix the problem by returning EFBIG described in man 2 write.

Similar change was done for binary sysfs files on commit
0936896056365349afa867c16e9f9100a6707cbf

Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Cc: linux-api@vger.kernel.org
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c