summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-12-16 12:25:13 +0000
committerTrond Myklebust <trond.myklebust@hammerspace.com>2020-12-16 07:54:42 -0500
commit7be9b38afafbfcc58ede3be66bfc4ea415b3d5f1 (patch)
tree3084f645de45a2bce9763c5bf2a5bab2bd87135d /fs/nfs
parentedffb84cc8edc5e5bfdf7336adeec3678274cda2 (diff)
downloadlinux-7be9b38afafbfcc58ede3be66bfc4ea415b3d5f1.tar.gz
linux-7be9b38afafbfcc58ede3be66bfc4ea415b3d5f1.tar.bz2
linux-7be9b38afafbfcc58ede3be66bfc4ea415b3d5f1.zip
NFSv4.2: fix error return on memory allocation failure
Currently when an alloc_page fails the error return is not set in variable err and a garbage initialized value is returned. Fix this by setting err to -ENOMEM before taking the error return path. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: a1f26739ccdc ("NFSv4.2: improve page handling for GETXATTR") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs42proc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index b9836e2ce4a2..f3fd935620fc 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -1301,6 +1301,7 @@ ssize_t nfs42_proc_getxattr(struct inode *inode, const char *name,
pages[i] = alloc_page(GFP_KERNEL);
if (!pages[i]) {
np = i + 1;
+ err = -ENOMEM;
goto out;
}
}