Skip to contentSkip to conversation

KVM: SVM: Fix "error" isn't initialized

PATCH linmiaohe 1 participant 1 message Nov 27, 2019

Subsystems (2)
lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 7 lines

From e7f9c786e43ef4f890b8a01f15f8f00786f4b14a Mon Sep 17 00:00:00 2001
From: Haiwei Li <[email protected]>
Date: Wed, 27 Nov 2019 15:00:49 +0800
Subject: [PATCH v2] fix: 'error' is not initialized

There are a bunch of error paths were "error" isn't initialized.

Review static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) · line 162

Quoted 8 lines
(quoted diff) +2 -0
@@ -155,6 +155,8 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
  	unsigned int phys_lsb, phys_msb;
  	unsigned int reg, ret = 0;
 
+	*psp_ret = -1;
+
  	if (!psp)
  		return -ENODEV;
 

The arg psp_ret may be NULL in some path such as sev_guest_df_flush(NULL). So you have to check it against NULL.
Thanks.