[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240910174836.8966-2-thorsten.blum@toblux.com>
Date: Tue, 10 Sep 2024 19:48:37 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: john.johansen@...onical.com,
paul@...l-moore.com,
jmorris@...ei.org,
serge@...lyn.com
Cc: apparmor@...ts.ubuntu.com,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
Thorsten Blum <thorsten.blum@...lux.com>
Subject: [PATCH] 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 <thorsten.blum@...lux.com>
---
security/apparmor/policy.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 14df15e35695..ce1c96cb2aed 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);
}
--
2.46.0
Powered by blists - more mailing lists