Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp945804pxb; Sun, 7 Mar 2021 00:45:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7YW+/ilL8kilS4z5iYbUNouPynJ8jEwOgJUMhQD0U34pFMunqcHUZ9lm/dIvX9UCjRIRP X-Received: by 2002:a05:6402:354d:: with SMTP id f13mr1325820edd.228.1615106757495; Sun, 07 Mar 2021 00:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615106757; cv=none; d=google.com; s=arc-20160816; b=0GWp5GstiY9RsdnETE4j2FtE1k/N8S1GQ17bq9NvKHDXLo5hMtAjFC3f2D1QO1/ThK XNw1Frno46QdCAIEQXg7VNqt/EtH2JWuVuWoDKaebs6/+wX2pwHAQNI9LmYAnWndXrUJ OkR+a9qCCl39y1ayQNg+PMtnLpXYV5BI+paipQBhu5aI/Wb7gz2B/jU2TDTxc8RmfU5p PHfklNifOXmQqtPOaMeHWAf3KxFCNRgEpBfSYPa/KjUTRDZabzr0KQj4EQrLkX63lYMb BPHa+G1sE9W2F5612erxTlNAng7JT7soN7Q15Azm++WPQQzcM6c5CkvnocajKUwMMego h7Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=zb+I3SxrI5NPVoptwXvVDUa4Jf+lOBb6Yh3g24lzCNM=; b=BAmXOtYm5Z/Oc0PX5aUAzj7gEz9/JyP1tW9WBwW5tjHGfXOkrOQ7L4GbiQ5YTEHcqF 1HXW7KSKT9RGvJdzbzx3g5IR4ft9pIaF2wskjivG5Im3H02AUYjsQasvEs+hNel+haMk FBq+QlurrPw+ITpCN4wKQaRUppuKDQszNbEn7v1Ceu1Mft0qSbEdymI71frfW2dkjnsJ 4x9vFUBUFF1L3MvcS2qcjIH/gLI15CVBAjGIeiUSQWcXKj9FkNRyzBd7D5xAbHL9PjVf Heej/34uROwBh5g+HIt+Aw5iebJvJT3AzyAdHZzSh1QVS6lefr6kXIT51Ix/ZNUilJMe wuPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="uglPs/SK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si5491598edf.499.2021.03.07.00.45.34; Sun, 07 Mar 2021 00:45:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="uglPs/SK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhCGIlE (ORCPT + 99 others); Sun, 7 Mar 2021 03:41:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbhCGIkh (ORCPT ); Sun, 7 Mar 2021 03:40:37 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8787CC06174A; Sun, 7 Mar 2021 00:40:37 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id q6-20020a17090a4306b02900c42a012202so1442806pjg.5; Sun, 07 Mar 2021 00:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zb+I3SxrI5NPVoptwXvVDUa4Jf+lOBb6Yh3g24lzCNM=; b=uglPs/SKwundv7PMctDtGocRd/BtZsAiyM2AR8CgZIqvzwSkYI8PCK3LgXWMyhUShq si1drAi4H1PmIpNsUOSYjNg7pzMOaqnGFMP50eThVWWcTHnQA4dYnscF6kgGMCq0K3ye n2E1E4R0XM5DGxJTsXOUijvdkBg7zfhVL8lNQ8VehFUAmQs7Hz3dBSd0vW6xQHp1c9aP uuNz4L5YaYK+1dT+GRdFIYPgdRydZwUqrhpk/mhknb5iAw9lr70aQezcgiZFKNWgd9CJ hdQbgq/M0qvvt52YKw+MuicFga2dkuXlV3n0LrYN1w47fndIPmsVz9O83LR010Zw4l2e dLUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zb+I3SxrI5NPVoptwXvVDUa4Jf+lOBb6Yh3g24lzCNM=; b=cpZZSrVLHL3d8vtHIwXlhRkCpoBVPvivcqC/7LFR6VzxTZuk9DK9h0eEwKLwNwQ6+A dBdYTRJMm72WGUoRZ4JP1pnV8tQW4gyJR4ApZxXvDqiTs9zlM7idRkm7p3hn1xuoS7u2 geE/nU5bKyO0VfRtMdM1ssGCx4HFV+0LXHTrdHpng8rC+KXRdjCjZ37PxMZz7ZBlBpah eMyCAgvZ0BzWbmm4sWSCuRLDuNFIfGGR+oTS7sHsXRScNYJOFfWG4kNZFVvwHTA+fMBf LkGTetZAvZgFo4wgIMFx7jL+VzJUXnZbe2Ugc6qVLUMleIKykXpvXNS9z6cUSuYWaLo0 L6Ug== X-Gm-Message-State: AOAM533ZDZsq61RWkgXb2OOYeV2SM/BxmWkLbso9otnyQ6l9KAuSk72K CoJhTtbKygokLRVD+sVCPrE= X-Received: by 2002:a17:90a:c902:: with SMTP id v2mr19408878pjt.144.1615106437140; Sun, 07 Mar 2021 00:40:37 -0800 (PST) Received: from localhost.localdomain ([45.135.186.66]) by smtp.gmail.com with ESMTPSA id q10sm6438043pfc.190.2021.03.07.00.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 00:40:36 -0800 (PST) From: Jia-Ju Bai To: yisen.zhuang@huawei.com, salil.mehta@huawei.com, davem@davemloft.net, kuba@kernel.org, tariqt@mellanox.com, jesse.brandeburg@intel.com, dinghao.liu@zju.edu.cn, trix@redhat.com, song.bao.hua@hisilicon.com, Jason@zx2c4.com, wanghai38@huawei.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch() Date: Sun, 7 Mar 2021 00:40:12 -0800 Message-Id: <20210307084012.21584-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When hns_assemble_skb() returns NULL to skb, no error return code of hns_nic_clear_all_rx_fetch() is assigned. To fix this bug, ret is assigned with -ENOMEM in this case. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 5d7824d2b4d4..c66a7a51198e 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev) for (j = 0; j < fetch_num; j++) { /* alloc one skb and init */ skb = hns_assemble_skb(ndev); - if (!skb) + if (!skb) { + ret = -ENOMEM; goto out; + } rd = &tx_ring_data(priv, skb->queue_mapping); hns_nic_net_xmit_hw(ndev, skb, rd); -- 2.17.1