From: Thorsten Blum Date: Thu, 7 Nov 2024 11:25:27 +0000 (+0100) Subject: apparmor: Remove unnecessary NULL check before kvfree() X-Git-Tag: microblaze-v6.16~497^2~12 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=648e45d724ed8d84064fa214028835dc02b0336e;p=linux-2.6-microblaze.git apparmor: Remove unnecessary NULL check before kvfree() Since kvfree() already checks if its argument is NULL, an additional check before calling kvfree() is unnecessary and can be removed. Remove it and the following Coccinelle/coccicheck warning reported by ifnullfree.cocci: WARNING: NULL check before some freeing functions is not needed Signed-off-by: Thorsten Blum Signed-off-by: John Johansen --- diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 105706abf281..c5446a1d20bf 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -103,8 +103,7 @@ static void aa_free_pdb(struct aa_policydb *pdb) { if (pdb) { aa_put_dfa(pdb->dfa); - if (pdb->perms) - kvfree(pdb->perms); + kvfree(pdb->perms); aa_free_str_table(&pdb->trans); kfree(pdb); }