net: scm: moving dereference after NULL check
Subsystems (2)
PATCH 1/1 net: scm: moving dereference after NULL check
scm_destroy_cred() dereferences 'scm' before null check
Signed-off-by Maxin B. John <[email protected]>
---
include/net/scm.h +5 -3
@@ -64,9 +64,11 @@ static __inline__ void scm_destroy_cred(struct scm_cookie *scm)static __inline__void scm_destroy (struct scm_cookie *scm) { -scm_destroy_cred (scm); -if (scm && scm->fp) -__scm_destroy (scm); +if (scm) { +scm_destroy_cred (scm); +if (scm->fp) +__scm_destroy (scm); + } } static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
David Miller
maintainerFrom: "Maxin B. John" <[email protected]>
Date: Sun, 23 Sep 2012 13:03:30 -0400
Quoted 3 lines
scm_destroy_cred()dereferences 'scm' before null checkSigned-off-by Maxin B. John <[email protected]>
Every caller of scm_destroy() passes a non-NULL scm, so the NULL test can be removed entirely.
I'll do this in net-next, thanks.