From: Dan Carpenter <dan.carpenter@oracle.com>
To: baolu.lu@linux.intel.com
Cc: Robin Murphy <robin.murphy@arm.com>, iommu@lists.linux.dev
Subject: [bug report] iommu/vt-d: Fix kdump kernels boot failure with scalable mode
Date: Thu, 15 Sep 2022 13:05:59 +0300 [thread overview]
Message-ID: <YyL5Bzy/QfUS5XDa@kili> (raw)
Hello Lu Baolu,
The patch 0c5f6c0d8201: "iommu/vt-d: Fix kdump kernels boot failure
with scalable mode" from Aug 23, 2022, leads to the following Smatch
static checker warning:
drivers/iommu/intel/iommu.c:224 set_context_copied() warn: set_bit() takes a bit number
drivers/iommu/intel/iommu.c:230 clear_context_copied() warn: clear_bit() takes a bit number
drivers/iommu/intel/iommu.c
221 static inline void
222 set_context_copied(struct intel_iommu *iommu, u8 bus, u8 devfn)
223 {
--> 224 set_bit(((long)bus << 8) | devfn, iommu->copied_tables);
225 }
This is trying to set a mask but it will instead corrupt a bit way out
in the middle of your memory. The set_bit function will only set one
bit at a time. If we want to set bit zero:
set_bit(0, iommu->copied_tables);
Or if we have a whole page full of bits then we could set the last one:
set_bit(32767, page);
regards,
dan carpenter
next reply other threads:[~2022-09-15 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 10:05 Dan Carpenter [this message]
2022-09-15 10:21 ` [bug report] iommu/vt-d: Fix kdump kernels boot failure with scalable mode Robin Murphy
2022-09-15 10:44 ` Dan Carpenter
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=YyL5Bzy/QfUS5XDa@kili \
--to=dan.carpenter@oracle.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=robin.murphy@arm.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