diff mbox series

SUNRPC: remove pointless test in unx_match()

Message ID 87d0p9j6v3.fsf@notabene.neil.brown.name (mailing list archive)
State New, archived
Headers show
Series SUNRPC: remove pointless test in unx_match() | expand

Commit Message

NeilBrown Jan. 7, 2019, 6:53 a.m. UTC
As reported by Dan Carpenter, this test for acred->cred being set is
inconsistent with the dereference of the pointer a few lines earlier.

An 'auth_cred' *always* has ->cred set - every place that creates one
initializes this field, often as the first thing done.

So remove this test.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NeilBrown <neilb@suse.com>
---
 net/sunrpc/auth_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Trond Myklebust Feb. 21, 2019, 10:39 p.m. UTC | #1
On Mon, 2019-01-07 at 17:53 +1100, NeilBrown wrote:
> As reported by Dan Carpenter, this test for acred->cred being set is
> inconsistent with the dereference of the pointer a few lines earlier.
> 
> An 'auth_cred' *always* has ->cred set - every place that creates one
> initializes this field, often as the first thing done.
> 
> So remove this test.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: NeilBrown <neilb@suse.com>
> 

Thanks Neil! Applied to the linux-next branch for inclusion in the 5.1
merge window.
diff mbox series

Patch

diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 387f6b3ffbea..770e338a9b11 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -87,7 +87,7 @@  unx_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
 	if (!uid_eq(cred->cr_cred->fsuid, acred->cred->fsuid) || !gid_eq(cred->cr_cred->fsgid, acred->cred->fsgid))
 		return 0;
 
-	if (acred->cred && acred->cred->group_info != NULL)
+	if (acred->cred->group_info != NULL)
 		groups = acred->cred->group_info->ngroups;
 	if (groups > UNX_NGROUPS)
 		groups = UNX_NGROUPS;