From: Dan Carpenter <dan.carpenter@oracle.com>
To: pgonda@google.com
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: ccp - Move SEV_INIT retry for corrupted data
Date: Mon, 10 Jan 2022 16:02:04 +0300 [thread overview]
Message-ID: <20220110130204.GA5984@kili> (raw)
Hello Peter Gonda,
The patch e423b9d75e77: "crypto: ccp - Move SEV_INIT retry for
corrupted data" from Dec 7, 2021, leads to the following Smatch
static checker warning:
drivers/crypto/ccp/sev-dev.c:430 __sev_platform_init_locked()
error: uninitialized symbol 'psp_ret'.
drivers/crypto/ccp/sev-dev.c
412 static int __sev_platform_init_locked(int *error)
413 {
414 struct psp_device *psp = psp_master;
415 struct sev_device *sev;
416 int rc, psp_ret;
417 int (*init_function)(int *error);
418
419 if (!psp || !psp->sev_data)
420 return -ENODEV;
421
422 sev = psp->sev_data;
423
424 if (sev->state == SEV_STATE_INIT)
425 return 0;
426
427 init_function = sev_init_ex_buffer ? __sev_init_ex_locked :
428 __sev_init_locked;
429 rc = init_function(&psp_ret);
--> 430 if (rc && psp_ret == SEV_RET_SECURE_DATA_INVALID) {
There are a bunch of failure paths where "rc" is set and "psp_ret" is
not initialized.
431 /*
432 * Initialization command returned an integrity check failure
433 * status code, meaning that firmware load and validation of SEV
434 * related persistent data has failed. Retrying the
435 * initialization function should succeed by replacing the state
436 * with a reset state.
437 */
438 dev_dbg(sev->dev, "SEV: retrying INIT command");
439 rc = init_function(&psp_ret);
440 }
441 if (error)
442 *error = psp_ret;
443
444 if (rc)
445 return rc;
446
447 sev->state = SEV_STATE_INIT;
448
449 /* Prepare for first SEV guest launch after INIT */
450 wbinvd_on_all_cpus();
451 rc = __sev_do_cmd_locked(SEV_CMD_DF_FLUSH, NULL, error);
452 if (rc)
453 return rc;
454
455 dev_dbg(sev->dev, "SEV firmware initialized\n");
456
457 dev_info(sev->dev, "SEV API:%d.%d build:%d\n", sev->api_major,
458 sev->api_minor, sev->build);
459
460 return 0;
461 }
regards,
dan carpenter
reply other threads:[~2022-01-10 13:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220110130204.GA5984@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-crypto@vger.kernel.org \
--cc=pgonda@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox