summaryrefslogtreecommitdiff
path: root/drivers/virt
diff options
context:
space:
mode:
authorRafael Mendonca <rafaelmendsr@gmail.com>2022-10-17 22:54:25 -0300
committerBorislav Petkov <bp@suse.de>2022-10-27 14:24:18 +0200
commitc6fbb759d68898aad40e57d09ed18df6094a1874 (patch)
tree121e687d0c69154b23a7c0566b3fd7350c3cfaeb /drivers/virt
parent9abf2313adc1ca1b6180c508c25f22f9395cc780 (diff)
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: fce96cf04430 ("virt: Add SEV-SNP guest driver") Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20221018015425.887891-1-rafaelmendsr@gmail.com
Diffstat (limited to 'drivers/virt')
-rw-r--r--drivers/virt/coco/sev-guest/sev-guest.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c
index f422f9c58ba7..e9704aecd7ee 100644
--- a/drivers/virt/coco/sev-guest/sev-guest.c
+++ b/drivers/virt/coco/sev-guest/sev-guest.c
@@ -152,12 +152,10 @@ static struct snp_guest_crypto *init_crypto(struct snp_guest_dev *snp_dev, u8 *k
crypto->a_len = crypto_aead_authsize(crypto->tfm);
crypto->authtag = kmalloc(crypto->a_len, GFP_KERNEL_ACCOUNT);
if (!crypto->authtag)
- goto e_free_auth;
+ goto e_free_iv;
return crypto;
-e_free_auth:
- kfree(crypto->authtag);
e_free_iv:
kfree(crypto->iv);
e_free_crypto: