ecryptfs: ecryptfs_msg_ctx_alloc_to_free(): remove kfree() redundant null check
PATCH 1/1 ecryptfs: ecryptfs_msg_ctx_alloc_to_free(): remove kfree() redundant null check
smatch analysis:
fs/ecryptfs/messaging.c:101 ecryptfs_msg_ctx_alloc_to_free() info:
redundant null check on msg_ctx->msg calling kfree()
Cc Tyler Hicks <[email protected]>
Cc Dustin Kirkland <[email protected]>
Signed-off-by Tim Gardner <[email protected]>
--- fs/ecryptfs/messaging.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ecryptfs/messaging.c +1 -2
@@ -97,8 +97,7 @@ static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx)void ecryptfs_msg_ctx_alloc_to_free (struct ecryptfs_msg_ctx *msg_ctx) {list_move (&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); -if (msg_ctx->msg) -kfree (msg_ctx->msg); +kfree (msg_ctx->msg); msg_ctx->msg =NULL ; msg_ctx->state =ECRYPTFS_MSG_CTX_STATE_FREE ; }
Signature · 1 line
1.7.9.5
Quoted 9 lines · Tim Gardner
smatch analysis:
fs/ecryptfs/messaging.c:101ecryptfs_msg_ctx_alloc_to_free()info:
redundant null check onmsg_ctx->msgcallingkfree()Cc Tyler Hicks <[email protected]>Cc Dustin Kirkland <[email protected]>Signed-off-by Tim Gardner <[email protected]>
Thanks, Tim. Pushed to the next branch atgit://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs.git
Tyler
Quoted 21 lines
--- fs/ecryptfs/messaging.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/ecryptfs/messaging.c +1
-2@@ -97,8 +97,7 @@ static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx)void ecryptfs_msg_ctx_alloc_to_free (struct ecryptfs_msg_ctx *msg_ctx) {list_move (&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); -if (msg_ctx->msg) -kfree (msg_ctx->msg); +kfree (msg_ctx->msg); msg_ctx->msg =NULL ; msg_ctx->state =ECRYPTFS_MSG_CTX_STATE_FREE ; }Signature · 1 line
1.7.9.5