Skip to content

Commit c6fbb75

Browse files
rafaelmsoaressuryasaimadhu
authored andcommitted
virt/sev-guest: Remove unnecessary free in init_crypto()
If the memory allocation for the auth tag fails, then there is no need to free it. Fixes: fce96cf ("virt: Add SEV-SNP guest driver") Signed-off-by: Rafael Mendonca <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9abf231 commit c6fbb75

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/virt/coco/sev-guest/sev-guest.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,10 @@ static struct snp_guest_crypto *init_crypto(struct snp_guest_dev *snp_dev, u8 *k
152152
crypto->a_len = crypto_aead_authsize(crypto->tfm);
153153
crypto->authtag = kmalloc(crypto->a_len, GFP_KERNEL_ACCOUNT);
154154
if (!crypto->authtag)
155-
goto e_free_auth;
155+
goto e_free_iv;
156156

157157
return crypto;
158158

159-
e_free_auth:
160-
kfree(crypto->authtag);
161159
e_free_iv:
162160
kfree(crypto->iv);
163161
e_free_crypto:

0 commit comments

Comments
 (0)