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 |
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 --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;
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(-)