From: Jacob Keller <jacob.e.keller@intel.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Petr Oros <poros@redhat.com>, <netdev@vger.kernel.org>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Paul Menzel <pmenzel@molgen.mpg.de>, Kees Cook <kees@kernel.org>,
Robert Malz <robert.malz@canonical.com>,
Ratheesh Kannoth <rkannoth@marvell.com>,
"Daniel Zahka" <daniel.zahka@gmail.com>,
<intel-wired-lan@lists.osuosl.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH iwl-net] ice: allow reading the last byte of the NVM and Shadow RAM regions
Date: Wed, 19 Aug 2026 11:00:53 -0700 [thread overview]
Message-ID: <de19e575-9ede-43bd-bd4e-00b8f4dd7afe@intel.com> (raw)
In-Reply-To: <98034c58-cb45-4367-a074-bc654af1ce77@intel.com>
On 8/19/2026 3:54 AM, Przemek Kitszel wrote:
> On 8/19/26 10:24, Petr Oros wrote:
>> ice_devlink_nvm_read() rejects a read whose end lands exactly on the
>> region size, so feeding back the size devlink itself reports fails:
>>
>> devlink region show pci/0000:04:00.0/nvm-flash
>> pci/0000:04:00.0/nvm-flash: size 10485760 snapshot [] max 1
>>
>> devlink region read pci/0000:04:00.0/nvm-flash address 0 length
>> 10485760
>> Error: ice: Cannot read beyond the region size.
>>
>> shadow-ram behaves the same. The regions are created with those sizes, so
>> a read ending on the size is the whole region and has to be allowed.
>> ice_read_flat_nvm() uses > for its own Shadow RAM check, and so does
>> ixgbe, which grew its region support from this code.
>>
>> Fixes: 3af4b40b0f2f ("ice: implement direct read for NVM and Shadow
>> RAM regions")
>> Signed-off-by: Petr Oros <poros@redhat.com>
>> ---
>> drivers/net/ethernet/intel/ice/devlink/devlink.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/
>> drivers/net/ethernet/intel/ice/devlink/devlink.c
>> index 8c2b63eef82bd5..a52b6044288975 100644
>> --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
>> +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
>> @@ -1953,7 +1953,7 @@ static int ice_devlink_nvm_read(struct devlink
>> *devlink,
>> return -EOPNOTSUPP;
>> }
>> - if (offset + size >= nvm_size) {
>> + if (offset + size > nvm_size) {
>> NL_SET_ERR_MSG_MOD(extack, "Cannot read beyond the region
>> size");
>> return -ERANGE;
>> }
>
> Thank you,
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Oops! Thanks for fixing my off-by-one error.
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Thanks,
Jake
prev parent reply other threads:[~2026-08-19 18:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 8:24 Petr Oros
2026-08-19 10:54 ` Przemek Kitszel
2026-08-19 18:00 ` Jacob Keller [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=de19e575-9ede-43bd-bd4e-00b8f4dd7afe@intel.com \
--to=jacob.e.keller@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=poros@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rkannoth@marvell.com \
--cc=robert.malz@canonical.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
all inboxes | Powered by JetHome®