From patchwork Thu Feb 4 03:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yongjun X-Patchwork-Id: 12066189 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13267C433E9 for ; Thu, 4 Feb 2021 03:19:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6D4064F65 for ; Thu, 4 Feb 2021 03:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234397AbhBDDTY (ORCPT ); Wed, 3 Feb 2021 22:19:24 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:12072 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232123AbhBDDTV (ORCPT ); Wed, 3 Feb 2021 22:19:21 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DWNy13c4dzMTcg; Thu, 4 Feb 2021 11:16:57 +0800 (CST) Received: from ubuntu.network (10.175.138.68) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 4 Feb 2021 11:18:28 +0800 From: Zheng Yongjun To: , , , CC: Zheng Yongjun Subject: [PATCH net-next] net: core: Return the correct errno code Date: Thu, 4 Feb 2021 11:19:23 +0800 Message-ID: <20210204031923.15264-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Originating-IP: [10.175.138.68] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF. Signed-off-by: Zheng Yongjun --- net/core/rtnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 7d7223691783..6df8fb25668b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -177,7 +177,7 @@ static int rtnl_register_internal(struct module *owner, struct rtnl_link *link, *old; struct rtnl_link __rcu **tab; int msgindex; - int ret = -ENOBUFS; + int ret = -ENOMEM; BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX); msgindex = rtm_msgindex(msgtype);