Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp582506pxk; Wed, 2 Sep 2020 09:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqRxBJuyF6Exvkdp0VtrLc1+rMwzH1WHR2BT/Hsr3vPTzlOA/Fgm8WWTuUPslNCf1U2RkB X-Received: by 2002:a17:906:a18e:: with SMTP id s14mr805379ejy.168.1599063506957; Wed, 02 Sep 2020 09:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599063506; cv=none; d=google.com; s=arc-20160816; b=F+QmhOM+0/f5Hgs8KaPpVu8yYH8qo04pa2GXdqAZ53Fjvz5HvavnF6MuC0Rb16xQY2 J5lXPVggvG5knQn4ho/i0dWmMMq0BCwwSq6b9aUs0qUGC5PoEMHpj4svHgkzQutmyvbB ot/QdswXTJ9hIiZzqryHKGjRn6TETY55kgQMW2fAgK0fQJFArHxq3oG3BSWsPc0G73o6 OO5JYaOglDnIkUcZ+DTU38jbTd2qgpJRswAMeHJk6nvcw25tzj5n+uzUgFy8Xd7v/WJo rksEXxMkhniofitK1Z8qLsPfXfi13dJ/SyEZ5ymGlmTuCEP8m+tzjdcDIFvL7Gv8oC+C pXiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=MgTmuaCeL0BZxFjCXffsKSHLPunIH7ogIiWWAOv7F4c=; b=dk/YsmcyjPgCW7nJDu47BBjX/tcJhTec8agVvOZOMt2g3Uu72JhPRwWi9r7mlq+Y/+ uTiLeDOJO0IOdGIAhaXlRarqHbrq3a/YfkFtybGw4Hea6qIWWMG4iNM+CK51hymbkPro 4t6SQbwh1xQWLbhmBWvvhAUl25eIL3ZKa2A8+M45GE9uAlOtNhT9t7BbXCzpWmG9EHXV SGSRrLKKt+kVAYFIqzXk0a8X9x7zdp/giEnaqEUHkN5rD31Ymcyii43j/JTf3KhRx7Zd tFgPxzd59SABtiAOLLfgtvsXfEgZKOfbwd/Xgs4b7A6LPG1mB3ktxz2XBfqhbnVpqhhx 2fvA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c61si2712190edf.394.2020.09.02.09.18.03; Wed, 02 Sep 2020 09:18:26 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728367AbgIBQQH (ORCPT + 99 others); Wed, 2 Sep 2020 12:16:07 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:59766 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbgIBQNj (ORCPT ); Wed, 2 Sep 2020 12:13:39 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kDVO8-0005jC-I8; Wed, 02 Sep 2020 16:13:32 +0000 From: Colin King To: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Jonathan Lemon , "David S . Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, bpf@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] xsk: fix incorrect memory allocation failure check on dma_map->dma_pages Date: Wed, 2 Sep 2020 17:13:32 +0100 Message-Id: <20200902161332.199961-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The failed memory allocation check for dma_map->dma_pages is incorrect, it is null checking dma_map and not dma_map->dma_pages. Fix this. Addresses-Coverity: ("Logicall dead code") Fixes: 921b68692abb ("xsk: Enable sharing of dma mappings") Signed-off-by: Colin Ian King --- net/xdp/xsk_buff_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index 795d7c81c0ca..5b00bc5707f2 100644 --- a/net/xdp/xsk_buff_pool.c +++ b/net/xdp/xsk_buff_pool.c @@ -287,7 +287,7 @@ static struct xsk_dma_map *xp_create_dma_map(struct device *dev, struct net_devi return NULL; dma_map->dma_pages = kvcalloc(nr_pages, sizeof(*dma_map->dma_pages), GFP_KERNEL); - if (!dma_map) { + if (!dma_map->dma_pages) { kfree(dma_map); return NULL; } -- 2.27.0