[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c3dda38-d741-8f5e-a034-b4678ed79fc0@wanadoo.fr>
Date: Fri, 12 Aug 2022 09:14:35 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
j.vosburgh@...il.com
Cc: vfalico@...il.com, andy@...yhouse.net, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: Re: [PATCH] bonding: return -ENOMEM on rlb_initialize() allocation
failure
Le 12/08/2022 à 05:20, Jiapeng Chong a écrit :
> drivers/net/bonding/bond_alb.c:861 rlb_initialize() warn: returning -1 instead of -ENOMEM is sloppy.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=1896
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
> ---
> drivers/net/bonding/bond_alb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
> index 60cb9a0225aa..96cb4404b3c7 100644
> --- a/drivers/net/bonding/bond_alb.c
> +++ b/drivers/net/bonding/bond_alb.c
> @@ -858,7 +858,7 @@ static int rlb_initialize(struct bonding *bond)
>
> new_hashtbl = kmalloc(size, GFP_KERNEL);
> if (!new_hashtbl)
> - return -1;
> + return -ENOMEM;
>
> spin_lock_bh(&bond->mode_lock);
>
Hi,
Nit: if of any use, the only call chain leads to [1]:
bond_open()
--> bond_alb_initialize()
--> rlb_initialize()
So, the error in bond_open() could be changed to ret instead of a hard
coded -ENOMEM.
Just my 2c,
Other than that, for what it worth,
Reviewed-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
CJ
[1]:
https://elixir.bootlin.com/linux/v5.19/source/drivers/net/bonding/bond_main.c#L4163
Powered by blists - more mailing lists