From c6fbb759d68898aad40e57d09ed18df6094a1874 Mon Sep 17 00:00:00 2001 From: Rafael Mendonca Date: Mon, 17 Oct 2022 22:54:25 -0300 Subject: 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 Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20221018015425.887891-1-rafaelmendsr@gmail.com --- drivers/virt/coco/sev-guest/sev-guest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/virt/coco') 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: -- cgit v1.2.3 From 2874529b3513bdc90299c90f40713602da685e35 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Fri, 4 Nov 2022 16:42:45 -0400 Subject: virt/sev-guest: Add a MODULE_ALIAS Autoload the driver when, for example, SNP init code creates the corresponding platform device. [ bp: Rewrite commit message. ] Fixes: fce96cf04430 ("virt: Add SEV-SNP guest driver") Signed-off-by: Cole Robinson Signed-off-by: Borislav Petkov Acked-by: Tom Lendacky Link: https://lore.kernel.org/r/ff480c5e688eb0a72a4db0a29c7b1bb54c45bfd4.1667594253.git.crobinso@redhat.com --- drivers/virt/coco/sev-guest/sev-guest.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/virt/coco') diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c index e9704aecd7ee..13911b9f037b 100644 --- a/drivers/virt/coco/sev-guest/sev-guest.c +++ b/drivers/virt/coco/sev-guest/sev-guest.c @@ -742,3 +742,4 @@ MODULE_AUTHOR("Brijesh Singh "); MODULE_LICENSE("GPL"); MODULE_VERSION("1.0.0"); MODULE_DESCRIPTION("AMD SEV Guest Driver"); +MODULE_ALIAS("platform:sev-guest"); -- cgit v1.2.3