diff options
author | Thorsten Blum <thorsten.blum@linux.dev> | 2024-11-07 12:25:27 +0100 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2024-11-26 19:21:05 -0800 |
commit | 648e45d724ed8d84064fa214028835dc02b0336e (patch) | |
tree | dd85b0cf4dabdf18e20460f4304175c9f5f0f5da /security | |
parent | ab6875fbb9d318f56ed0c393c455e9f48293b00f (diff) |
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@linux.dev>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/policy.c | 3 |
1 files changed, 1 insertions, 2 deletions
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); } |