X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=fs%2Fnfs%2Fidmap.c;h=86147b0ab2cf752a61adc2f06c64f56aec9af53b;hb=4da727ae2aa62f134c79d38c41d15f50d912745f;hp=c56fc7d5a46e234ae7e9e51a0bc10b45d3cf1381;hpb=369af0f1166f7a637751110395496cee156b4297;p=linux-2.6-omap-h63xx.git diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index c56fc7d5a46..86147b0ab2c 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c @@ -74,7 +74,7 @@ module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int, struct idmap_hashent { unsigned long ih_expires; __u32 ih_id; - int ih_namelen; + size_t ih_namelen; char ih_name[IDMAP_NAMESZ]; }; @@ -193,7 +193,7 @@ idmap_lookup_id(struct idmap_hashtable *h, __u32 id) * pretty trivial. */ static inline struct idmap_hashent * -idmap_alloc_name(struct idmap_hashtable *h, char *name, unsigned len) +idmap_alloc_name(struct idmap_hashtable *h, char *name, size_t len) { return idmap_name_hash(h, name, len); } @@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, mutex_lock(&idmap->idmap_im_lock); he = idmap_lookup_id(h, id); - if (he != 0) { + if (he) { memcpy(name, he->ih_name, he->ih_namelen); ret = he->ih_namelen; goto out; @@ -358,17 +358,15 @@ idmap_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg, char __user *dst, size_t buflen) { char *data = (char *)msg->data + msg->copied; - ssize_t mlen = msg->len - msg->copied; - ssize_t left; - - if (mlen > buflen) - mlen = buflen; + size_t mlen = min(msg->len, buflen); + unsigned long left; left = copy_to_user(dst, data, mlen); - if (left < 0) { - msg->errno = left; - return left; + if (left == mlen) { + msg->errno = -EFAULT; + return -EFAULT; } + mlen -= left; msg->copied += mlen; msg->errno = 0; @@ -383,7 +381,7 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) struct idmap_msg im_in, *im = &idmap->idmap_im; struct idmap_hashtable *h; struct idmap_hashent *he = NULL; - int namelen_in; + size_t namelen_in; int ret; if (mlen != sizeof(im_in))