Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp593228pxk; Wed, 2 Sep 2020 09:34:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy32+fM5V/E8IEP6KIUqyN/0dlQczCSbZF//rRmmWrwc4ZcYAM4hAGWvN4S4Ib6K8YoSfql X-Received: by 2002:aa7:c0d3:: with SMTP id j19mr971921edp.40.1599064483727; Wed, 02 Sep 2020 09:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599064483; cv=none; d=google.com; s=arc-20160816; b=fBvPmiSyn/9YM26OAIi1oGHaHxcI9/r7DsqXl+B7C0Yi26bAt6zwhcY21pLWWEk13k Sdf894fY+6YY71CBzk1yn7se/G9FrTKREgcHP0Orl9t1x3Xq4xPCaq7w5xS+F+RwXyv9 IWjINsPZG5A2jY2ckoCCAmV9HMdpZU6/6e/zP+FhODgTmVC+qBV4H5DANTF1+Ej92T2s ey4182lXwbEk0M2fM+6VPDaXsLg7jdQEQAz0GqHsXIvlqo+m0bGex3VhI7Ic3mh71f2p ktr1BpHLJ3ChuSGwwmiDX249UGj8Q25Yw6Buz5Zk+IA/bD2rwgEBuq5vG1vmEDfjfgBY evxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=/2qvkwmqjjGM0RfjIplcORNd0dXrXenfHRoPeccCbQs=; b=bVkcTMcBV/aqbwQbXTzugF1+VlfxyjjJKBxcEbEE8YJFQ4vf7yVqjnMhTYigXJFD7t ps/tyzJPC2nZ+Sp1yXfxaVEJRde05YGwCcsRptLsCI42LjYfcmpJYk/G0H5CEW5xiF4P FeYdoT128tn4DA+/a96O/VmkBRE7lk6IpeRiLPpTZ/Quyk1xkvYVGurfmdewFmqz7NYd lVGUQ5KFRZle3p6ydCImaxxY0wYgH53B3mA/Ser/OjtOb3O4byTmp+zRyOuVqmNgee3F POfZCSjuKDEF23bUECzo9zZ8rx7k0SNC6Qdjzjpkg9Jx1AwrtUaIlqSkR5G4k1qviEfD ASOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KXdH0tcs; 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=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 q3si2945083edg.429.2020.09.02.09.34.20; Wed, 02 Sep 2020 09:34:43 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KXdH0tcs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgIBQd2 (ORCPT + 99 others); Wed, 2 Sep 2020 12:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgIBQd1 (ORCPT ); Wed, 2 Sep 2020 12:33:27 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81355C061244; Wed, 2 Sep 2020 09:33:25 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id w2so38892wmi.1; Wed, 02 Sep 2020 09:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/2qvkwmqjjGM0RfjIplcORNd0dXrXenfHRoPeccCbQs=; b=KXdH0tcsr9jfN4LME7Eb84NGipaYEBMx/4+RmQdbyAVwvyGz/ShRyowlf6Rdyr4QnY vVfKBHD5FL98h2XvAsSRJUV5OGLUwMPORVwHuHnKVTMs3X92tIzDMTgILqiZU2thOles 4k5n3Dnt08XLYzpEM8UPqnEKMBIKnsAfg5iws8ljUgmu4uW3gMxRXSAEuWnJQeDm4zL/ 9wYGwdrz1I2yOYuL5wDnhzjEbz4krFN6h7T1mRDD3raE33VIoMDm06b9btfnbDWhMFPu YwqeB0Dmb87GNBAoe5Of5Tt3/IVlz9W7dN943AgfxXxc5J0eyOHvutxymLEGcO1C3I0Y +2WQ== 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:mime-version :content-transfer-encoding; bh=/2qvkwmqjjGM0RfjIplcORNd0dXrXenfHRoPeccCbQs=; b=eE6LzxVexLIXlCadXkkTuuZoaDT3wxup/ia9XGdmMAnw2jGK48cFlFCFhz8WZOmnbJ Mc6wquYN2Ae0+3TcXgC14LfY6bKjInHP9DPdxcoLCWaXrlkuEkEd1ZdH/pFo5mqxhbQm NylwZqG1PmVBB8x7CooRb8PCSpxMH466L1XgZWEtxOkiU0R36FgzpCA0HlH9AT4ArRnE zhs7NhknBDLfMV3QSzYDjAmAMZfYcia1rd5o3oOxhZpd3oBgJZdR9QLZJkUJqH0DPq/K oS8L43AdusOAnA3e8ik4F+nBqUKW82OJWmrR//WBxVgEAH/CSni/A1Mz+y3IvjChhZID ViiA== X-Gm-Message-State: AOAM530l0qGXSDbiGUSpg1YX+Ab7qysIhIpx+CFwEt/TBbACwQAG1nvu S8662ymfokQtyV05Spr+wZaQMZ5g4v79wcVt X-Received: by 2002:a1c:1f42:: with SMTP id f63mr1424093wmf.1.1599064404161; Wed, 02 Sep 2020 09:33:24 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id y6sm237545wrt.80.2020.09.02.09.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 09:33:23 -0700 (PDT) From: Alex Dewar Cc: Alex Dewar , =?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, linux-kernel@vger.kernel.org Subject: [PATCH] xsk: Free variable on error path Date: Wed, 2 Sep 2020 17:33:19 +0100 Message-Id: <20200902163319.345284-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In xp_create_dma_map(), memory is allocated to dma_map->dma_pages, but then dma_map is erroneously compared to NULL, rather than the member. Fix this. Addresses-Coverity: ("Dead code") Fixes: 921b68692abb ("xsk: Enable sharing of dma mappings") Signed-off-by: Alex Dewar --- 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.28.0