mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ashish Kalra <Ashish.Kalra@amd.com>
To: <x86@kernel.org>
Cc: <iommu@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<bp@alien8.de>, <thomas.lendacky@amd.com>, <michael.roth@amd.com>,
	<dan.carpenter@linaro.org>
Subject: [PATCH] iommu/amd: Fix failure return from snp_lookup_rmpentry().
Date: Mon, 5 Feb 2024 21:06:54 +0000	[thread overview]
Message-ID: <20240205210654.219442-1-Ashish.Kalra@amd.com> (raw)

From: Ashish Kalra <ashish.kalra@amd.com>

The patch f366a8dac1b8: "iommu/amd: Clean up RMP entries for IOMMU
pages during SNP shutdown" (linux-next), leads to the following
Smatch static checker warning:

	drivers/iommu/amd/init.c:3820 iommu_page_make_shared()
	error: uninitialized symbol 'assigned'.

Fix it.

Fixes: f366a8dac1b8 ("iommu/amd: Clean up RMP entries for IOMMU pages during SNP shutdown")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-iommu/1be69f6a-e7e1-45f9-9a74-b2550344f3fd@moroto.mountain/
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Link: https://lore.kernel.org/lkml/20240126041126.1927228-20-michael.roth@amd.com/
---
 drivers/iommu/amd/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 88bb08ae39b2..11340380111d 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3813,9 +3813,11 @@ static int iommu_page_make_shared(void *page)
 		bool assigned;
 
 		ret = snp_lookup_rmpentry(pfn, &assigned, &level);
-		if (ret)
+		if (ret) {
 			pr_warn("IOMMU PFN %lx RMP lookup failed, ret %d\n",
 				pfn, ret);
+			return ret;
+		}
 
 		if (!assigned)
 			pr_warn("IOMMU PFN %lx not assigned in RMP table\n",
-- 
2.34.1


             reply	other threads:[~2024-02-05 21:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 21:06 Ashish Kalra [this message]
2024-02-06 11:31 ` Borislav Petkov

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=20240205210654.219442-1-Ashish.Kalra@amd.com \
    --to=ashish.kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=dan.carpenter@linaro.org \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@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

all inboxes | Powered by JetHome®