Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1435226rwb; Fri, 12 Aug 2022 00:23:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR4wUjsRw5pAZpt5qwatD+HVqylpbLPW9N0PIn8gOmT1jXktEAKa0JrMuwzrTzlpJGsDN2ZT X-Received: by 2002:a05:6402:304c:b0:440:d482:2fa6 with SMTP id bs12-20020a056402304c00b00440d4822fa6mr2473688edb.344.1660289008103; Fri, 12 Aug 2022 00:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660289008; cv=none; d=google.com; s=arc-20160816; b=hA5zVh5e55983DaT/A2e59hyz8ChWsvVLH395D9HlFlrJrpXdp+CyAmyX1CKS/E1uz I57NzmPS6V/YiBjuz33IQHXyM53WUXCn32xjJXuwUSAC7CQiE+1QdJvARQNFvvXyGzYI N/vRlcj6eNCdtI5VnsNUt/gZv6kU5K1sYTHm4qdXl8PJsmRoIM4oG8INmK3KU+SJ115f y9noa15oc1CU9i14bI7u/2UvYSzs9DwtD0iKbu+0WkgBDbxOYgUJCTsE2+7a0LjU/9jj qgKEAkLehNHqRWhi1E29q/rH/o+SjmBXeNxmrgRGdEzQSyX8i/dJI9vv56mJO29qSzzH saUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=VUSSKgkBv5bjv/jrr7gfN2JE4HxA7CnKaT6SG2xCf/o=; b=J5O84Chn6RZfWr9pxQ/wh/8DBqvQiWmP6u63ljkJjFTNlvyd6/fBu4CPWNwDHm/7/e CzJXKr3EyKVEXJgAYc/cZ/vzH0Kazqa+bjOIPXumYc0KSrrWraLxSxuVuxak5AoqECiD dsQDFspLGLEEZeC8sV3oNTh+jPapW8A2tdoPU2PmvRK9FgXos8t6jzv+60spFLyx8hr6 iF1mKXJHeQ8AdLG9Z5LwxL0moYbA8KfSsoYgVOQDXOnEeBzTZ/d1Ud9WgCJa//IxzZVn wfAg92FTKOVkMvxv06MrGe5sPhZdFGrDHw72J+/z6/BcOlYC3wGXxJ+n6ud46EDAjapH rj9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a056402355000b0043ddebb56a0si1679667edd.61.2022.08.12.00.23.02; Fri, 12 Aug 2022 00:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237214AbiHLHOp (ORCPT + 99 others); Fri, 12 Aug 2022 03:14:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237127AbiHLHOn (ORCPT ); Fri, 12 Aug 2022 03:14:43 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4105531DEA for ; Fri, 12 Aug 2022 00:14:39 -0700 (PDT) Received: from [192.168.1.18] ([90.11.190.129]) by smtp.orange.fr with ESMTPA id MOsNovEvhsfCIMOsNocAyy; Fri, 12 Aug 2022 09:14:37 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 12 Aug 2022 09:14:37 +0200 X-ME-IP: 90.11.190.129 Message-ID: <7c3dda38-d741-8f5e-a034-b4678ed79fc0@wanadoo.fr> Date: Fri, 12 Aug 2022 09:14:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] bonding: return -ENOMEM on rlb_initialize() allocation failure Content-Language: en-US To: Jiapeng Chong , j.vosburgh@gmail.com Cc: vfalico@gmail.com, andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Abaci Robot References: <20220812032059.64572-1-jiapeng.chong@linux.alibaba.com> From: Christophe JAILLET In-Reply-To: <20220812032059.64572-1-jiapeng.chong@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Jiapeng Chong > --- > 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 CJ [1]: https://elixir.bootlin.com/linux/v5.19/source/drivers/net/bonding/bond_main.c#L4163