[PATCH] CRYPTO: Fix initialize 'psp_ret' to avoid uninitialized usage in error paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From 842cac9822aafd3cfe2da154b92b033fa1ed0d2d Mon Sep 17 00:00:00 2001
From: Haiwei Li <lihaiwei@xxxxxxxxxxx>
Date: Thu, 28 Nov 2019 08:25:16 +0800
Subject: [PATCH] fix: initialize @psp_ret to avoid uninitialized usage in error paths

Initialize @psp_ret to -1 to avoid uninitialized usage in error paths.
Such as the function 'sev_flush_asides' in file 'arch/x86/kvm/svm.c'.


Signed-off-by: Haiwei Li <lihaiwei@xxxxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/crypto/ccp/psp-dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 39fdd06..3501562 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -155,6 +155,9 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
 	unsigned int phys_lsb, phys_msb;
 	unsigned int reg, ret = 0;

+	if (psp_ret)
+		*psp_ret = -1;
+
 	if (!psp)
 		return -ENODEV;

--
1.8.3.1



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux