summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-09-07 09:41:30 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-07 10:27:15 +0200
commit361d5bd7730befeaea63c53dd3d22fac6914a966 (patch)
treecdada794e067fe8ca44f38db6f481fca4a9aaae7
parent38d288b4e60470251f075bfb2a01f073419895e9 (diff)
downloadbarebox-361d5bd7730befeaea63c53dd3d22fac6914a966.tar.gz
barebox-361d5bd7730befeaea63c53dd3d22fac6914a966.tar.xz
fs/nfs: fix read when size < 1024
Currently we always request 1024. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/nfs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 4a880cd302..797e3bd471 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -819,7 +819,11 @@ static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
insize -= now;
if (insize) {
- now = 1024;
+ /* do not use min as insize is a size_t */
+ if (insize < 1024)
+ now = insize;
+ else
+ now = 1024;
if (pos + now > file->size)
now = file->size - pos;