From patchwork Thu Feb 4 08:56:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yongjun X-Patchwork-Id: 12066631 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.7 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 1084CC433E6 for ; Thu, 4 Feb 2021 08:56:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C513D64F45 for ; Thu, 4 Feb 2021 08:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235053AbhBDI40 (ORCPT ); Thu, 4 Feb 2021 03:56:26 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:12126 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbhBDI4Z (ORCPT ); Thu, 4 Feb 2021 03:56:25 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DWXRL4W9Jz163vC; Thu, 4 Feb 2021 16:54:22 +0800 (CST) Received: from ubuntu.network (10.175.138.68) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Thu, 4 Feb 2021 16:55:33 +0800 From: Zheng Yongjun To: , , , , CC: Zheng Yongjun Subject: [PATCH net-next] net: Return the correct errno code Date: Thu, 4 Feb 2021 16:56:30 +0800 Message-ID: <20210204085630.19452-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 kzalloc failed, should return ENOMEM rather than ENOBUFS. Signed-off-by: Zheng Yongjun --- net/decnet/dn_dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 15d42353f1a3..50e375dcd5bd 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -469,7 +469,7 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg) case SIOCSIFADDR: if (!ifa) { if ((ifa = dn_dev_alloc_ifa()) == NULL) { - ret = -ENOBUFS; + ret = -ENOMEM; break; } memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); @@ -645,7 +645,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, } if ((ifa = dn_dev_alloc_ifa()) == NULL) - return -ENOBUFS; + return -ENOMEM; if (tb[IFA_ADDRESS] == NULL) tb[IFA_ADDRESS] = tb[IFA_LOCAL]; @@ -1088,7 +1088,7 @@ static struct dn_dev *dn_dev_create(struct net_device *dev, int *err) if (i == DN_DEV_LIST_SIZE) return NULL; - *err = -ENOBUFS; + *err = -ENOMEM; if ((dn_db = kzalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL) return NULL;