From: Dan Carpenter <dan.carpenter@linaro.org>
To: Ashish Kalra <ashish.kalra@amd.com>
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: ccp - Move dev_info/err messages for SEV/SNP init and shutdown
Date: Wed, 9 Apr 2025 13:59:01 +0300 [thread overview]
Message-ID: <d9c2e79c-e26e-47b7-8243-ff6e7b101ec3@stanley.mountain> (raw)
Hello Ashish Kalra,
Commit 9770b428b1a2 ("crypto: ccp - Move dev_info/err messages for
SEV/SNP init and shutdown") from Mar 24, 2025 (linux-next), leads to
the following Smatch static checker warning:
drivers/crypto/ccp/sev-dev.c:1755 __sev_snp_shutdown_locked()
error: uninitialized symbol 'dfflush_error'.
drivers/crypto/ccp/sev-dev.c
1718 static int __sev_snp_shutdown_locked(int *error, bool panic)
1719 {
1720 struct psp_device *psp = psp_master;
1721 struct sev_device *sev;
1722 struct sev_data_snp_shutdown_ex data;
1723 int ret;
1724
1725 if (!psp || !psp->sev_data)
1726 return 0;
1727
1728 sev = psp->sev_data;
1729
1730 if (!sev->snp_initialized)
1731 return 0;
1732
1733 memset(&data, 0, sizeof(data));
1734 data.len = sizeof(data);
1735 data.iommu_snp_shutdown = 1;
1736
1737 /*
1738 * If invoked during panic handling, local interrupts are disabled
1739 * and all CPUs are stopped, so wbinvd_on_all_cpus() can't be called.
1740 * In that case, a wbinvd() is done on remote CPUs via the NMI
1741 * callback, so only a local wbinvd() is needed here.
1742 */
1743 if (!panic)
1744 wbinvd_on_all_cpus();
1745 else
1746 wbinvd();
1747
1748 ret = __sev_do_cmd_locked(SEV_CMD_SNP_SHUTDOWN_EX, &data, error);
1749 /* SHUTDOWN may require DF_FLUSH */
1750 if (*error == SEV_RET_DFFLUSH_REQUIRED) {
1751 int dfflush_error;
1752
1753 ret = __sev_do_cmd_locked(SEV_CMD_SNP_DF_FLUSH, NULL, &dfflush_error);
1754 if (ret) {
--> 1755 dev_err(sev->dev, "SEV-SNP DF_FLUSH failed, ret = %d, error = %#x\n",
1756 ret, dfflush_error);
^^^^^^^^^^^^^
dfflush_error isn't necessarily initialized on error in
__sev_do_cmd_locked().
regards,
dan carpenter
1757 return ret;
1758 }
1759 /* reissue the shutdown command */
1760 ret = __sev_do_cmd_locked(SEV_CMD_SNP_SHUTDOWN_EX, &data,
1761 error);
reply other threads:[~2025-04-09 10:59 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=d9c2e79c-e26e-47b7-8243-ff6e7b101ec3@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=ashish.kalra@amd.com \
--cc=linux-crypto@vger.kernel.org \
/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