RE: [PATCH] net: mana: store return status in signed variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Subject: [PATCH] net: mana: store return status in signed variable
> 
> [Some people who received this message don't often get email from
> usama.anjum@xxxxxxxxxxxxx. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
> 
> The mana_adev_idx_alloc() can return negative value. Save its return value
> in ret which is signed variable and check if it is correct value.
> 
> Fixes: ee928282bfa7 ("net: mana: Add support for auxiliary device")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c
> b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 7ca313c7b7b3..1c59502d34b5 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -2203,11 +2203,10 @@ static int add_adev(struct gdma_dev *gd)
>                 return -ENOMEM;
> 
>         adev = &madev->adev;
> -       adev->id = mana_adev_idx_alloc();
> -       if (adev->id < 0) {
> -               ret = adev->id;
> +       ret = mana_adev_idx_alloc();
> +       if (ret < 0)
>                 goto idx_fail;
> -       }
> +       adev->id = ret;
> 
>         adev->name = "rdma";
>         adev->dev.parent = gd->gdma_context->dev;
> --
> 2.30.2

Thank you, I'm folding this patch into the next v7 patch series.

Long




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux