From: KAMBAROV, ZAUR Date: Fri, 8 Jul 2005 00:57:06 +0000 (-0700) Subject: [PATCH] coverity: fs/locks.c flp null check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7eaae2828dadae3abde7f77734c874d4b74b313a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] coverity: fs/locks.c flp null check We're dereferencing `flp' and then we're testing it for NULLness. Either the compiler accidentally saved us or the existing null-pointer checdk is redundant. This defect was found automatically by Coverity Prevent, a static analysis tool. Signed-off-by: Zaur Kambarov Cc: Matthew Wilcox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/locks.c b/fs/locks.c index a0bc03495bd4..29fa5da6c117 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1276,7 +1276,7 @@ int fcntl_getlease(struct file *filp) */ static int __setlease(struct file *filp, long arg, struct file_lock **flp) { - struct file_lock *fl, **before, **my_before = NULL, *lease = *flp; + struct file_lock *fl, **before, **my_before = NULL, *lease; struct dentry *dentry = filp->f_dentry; struct inode *inode = dentry->d_inode; int error, rdlease_count = 0, wrlease_count = 0; @@ -1287,6 +1287,8 @@ static int __setlease(struct file *filp, long arg, struct file_lock **flp) if (!flp || !(*flp) || !(*flp)->fl_lmops || !(*flp)->fl_lmops->fl_break) goto out; + lease = *flp; + error = -EAGAIN; if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) goto out;