From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6] PCI: mediatek: Fix integer truncation and handle oversized resources
Date: Wed, 28 Oct 2026 11:42:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-187830@kernel.org> (raw)
In-Reply-To: <20261028113453.2599-1-sreekuttan2156239@gmail.com>
> resource_size() returns a resource_size_t, which can be 64-bit on
> 64-bit architectures or 32-bit systems with LPAE/PAE enabled.
> Passing this directly to fls(), which accepts an unsigned int,
> implicitly truncates the upper bits.
>
> Furthermore, AHB2PCIE_SIZE() uses a 5-bit mask GENMASK(4, 0). If
> the size order exceeds the range representable by this field,
> higher bits are discarded by the mask. This can leave the hardware
> translation window smaller than the OS resource, causing bus
> errors when accessing BARs in the unmapped upper region.
>
> Fix this by using fls64(size) to calculate the size order without
> truncating the resource size, and return -EINVAL if the size order
> exceeds the supported range.
>
> [ ... ]
> sizes and prevent integer truncation.
> [Subject: PCI: mediatek: Fix integer truncation in fls()
> for resource size]
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261028113453.2599-1-sreekuttan2156239@gmail.com?part=1
prev parent reply other threads:[~2026-10-28 11:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 12:05 [PATCH v4] PCI: mediatek: Fix integer truncation and handle oversized resources Sreeraj S Kurup
2026-09-30 12:13 ` sashiko-bot
2026-09-30 15:07 ` Sreeraj S Kurup
2026-10-27 13:11 ` Manivannan Sadhasivam
2026-10-28 10:34 ` Sreeraj S Kurup
2026-10-28 10:52 ` [PATCH v5] " Sreeraj S Kurup
2026-10-28 11:00 ` sashiko-bot
2026-10-28 11:34 ` [PATCH v6] " Sreeraj S Kurup
2026-10-28 11:42 ` sashiko-bot [this message]
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=sashiko-outbox-187830@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sreekuttan2156239@gmail.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