[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3bd1622d-438a-4903-b87a-08987f98c449@redhat.com>
Date: Thu, 13 Feb 2025 11:13:00 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Justin Stitt <justinstitt@...gle.com>,
Tariq Toukan <ttoukan.linux@...il.com>
Cc: Kees Cook <kees@...nel.org>, Tariq Toukan <tariqt@...dia.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Yishai Hadas <yishaih@...dia.com>,
netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net/mlx4_core: Avoid impossible mlx4_db_alloc() order
value
On 2/13/25 1:10 AM, Justin Stitt wrote:
> On Tue, Feb 11, 2025 at 6:22 AM Tariq Toukan <ttoukan.linux@...il.com> wrote:
>> On 11/02/2025 2:01, Justin Stitt wrote:
>>>> diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> index b330020dc0d6..f2bded847e61 100644
>>>> --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> @@ -682,9 +682,9 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device)
>>>> }
>>>>
>>>> static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir,
>>>> - struct mlx4_db *db, int order)
>>>> + struct mlx4_db *db, unsigned int order)
>>>> {
>>>> - int o;
>>>> + unsigned int o;
>>>> int i;
>>>>
>>>> for (o = order; o <= 1; ++o) {
>>>
>>> ^ Knowing now that @order can only be 0 or 1 can this for loop (and
>>> goto) be dropped entirely?
>>>
>>
>> Maybe I'm missing something...
>> Can you please explain why you think this can be dropped?
>
> I meant "rewritten to use two if statements" instead of "dropped". I
> think "replaced" or "refactored" was the word I wanted.
IMHO that would be a significant uglification, not worthy to address an
issue that could be solved with the patch proposed here.
@Tariq: are you ok with this patch?
Thanks,
Paolo
Powered by blists - more mailing lists