Commit c6fbb759 authored by Rafael Mendonca's avatar Rafael Mendonca Committed by Borislav Petkov
Browse files

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: fce96cf0 ("virt: Add SEV-SNP guest driver")
Signed-off-by: default avatarRafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221018015425.887891-1-rafaelmendsr@gmail.com
parent 9abf2313
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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: