[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bb5f6f98-75aa-44df-a70a-0f25b1efa4a3@altera.com>
Date: Fri, 12 Sep 2025 10:34:21 +0530
From: "G Thomas, Rohan" <rohan.g.thomas@...era.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "Russell King (Oracle)" <linux@...linux.org.uk>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jose Abreu <Jose.Abreu@...opsys.com>,
Rohan G Thomas <rohan.g.thomas@...el.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Matthew Gerlach <matthew.gerlach@...era.com>
Subject: Re: [PATCH net 1/2] net: stmmac: est: Fix GCL bounds checks
Hi Jakub,
Thanks for reviewing the patch.
On 9/12/2025 5:31 AM, Jakub Kicinski wrote:
> On Thu, 11 Sep 2025 18:12:16 +0530 G Thomas, Rohan wrote:
>> On 9/11/2025 4:54 PM, Russell King (Oracle) wrote:
>>> On Thu, Sep 11, 2025 at 04:22:59PM +0800, Rohan G Thomas via B4 Relay wrote:
>>>> @@ -1012,7 +1012,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
>>>> s64 delta_ns = qopt->entries[i].interval;
>>>> u32 gates = qopt->entries[i].gate_mask;
>>>>
>>>> - if (delta_ns > GENMASK(wid, 0))
>>>> + if (delta_ns >= BIT(wid))
>>>
>>> While I agree this makes it look better, you don't change the version
>>> below, which makes the code inconsistent. I also don't see anything
>>> wrong with the original comparison.
>>
>> Just to clarify the intent behind this change:
>> For example, if wid = 3, then GENMASK(3, 0) = 0b1111 = 15. But the
>> maximum supported gate interval in this case is actually 7, since only 3
>> bits are available to represent the value. So in the patch, the
>> condition delta_ns >= BIT(wid) effectively checks if delta_ns is 8 or
>> more, which correctly returns an error for values that exceed the 3-bit
>> limit.
>
> Comparison to BIT() looks rather odd, I think it's better to correct
> the GENMASK() bound?
Sure I'll update the condition to use GENMASK(wid - 1, 0) in the next
version. That should make the logic consistent with the checks below.
Best Regards,
Rohan
Powered by blists - more mailing lists