Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: ccp - Fix dereferencing uninitialized error pointer

Fix below smatch warnings:
drivers/crypto/ccp/sev-dev.c:1312 __sev_platform_init_locked()
error: we previously assumed 'error' could be null

Fixes: 9770b428b1a2 ("crypto: ccp - Move dev_info/err messages for SEV/SNP init and shutdown")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202505071746.eWOx5QgC-lkp@intel.com/
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ashish Kalra and committed by
Herbert Xu
0fa76672 1b9209d5

+5 -3
+5 -3
drivers/crypto/ccp/sev-dev.c
··· 1276 1276 1277 1277 static int __sev_platform_init_locked(int *error) 1278 1278 { 1279 - int rc, psp_ret = SEV_RET_NO_FW_CALL; 1279 + int rc, psp_ret, dfflush_error; 1280 1280 struct sev_device *sev; 1281 + 1282 + psp_ret = dfflush_error = SEV_RET_NO_FW_CALL; 1281 1283 1282 1284 if (!psp_master || !psp_master->sev_data) 1283 1285 return -ENODEV; ··· 1322 1320 1323 1321 /* Prepare for first SEV guest launch after INIT */ 1324 1322 wbinvd_on_all_cpus(); 1325 - rc = __sev_do_cmd_locked(SEV_CMD_DF_FLUSH, NULL, error); 1323 + rc = __sev_do_cmd_locked(SEV_CMD_DF_FLUSH, NULL, &dfflush_error); 1326 1324 if (rc) { 1327 1325 dev_err(sev->dev, "SEV: DF_FLUSH failed %#x, rc %d\n", 1328 - *error, rc); 1326 + dfflush_error, rc); 1329 1327 return rc; 1330 1328 } 1331 1329