Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2086924pxb; Mon, 12 Apr 2021 14:05:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRemsnS3f8TOsei+zr+91T9JYcewzaQU/hA2kSkRo5M4LIuXxY3E8VtAVsq52qf57tW97b X-Received: by 2002:a17:906:37c9:: with SMTP id o9mr10442687ejc.285.1618261531260; Mon, 12 Apr 2021 14:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618261531; cv=none; d=google.com; s=arc-20160816; b=UKP/WL8BMebOOrP+U9l27n1UG+3CoF0YziTw2JL6KJ7cKNMDpQBT7dEXMFVO0jfT3D iij5ofIkuFu/aByPeXCqBBXq9HqMH+IJtBuvBkQTSRtuT4t8jIDEOsyVt8JFDhUm8iuw GUWL6ZZ/Ude16TrwlYP0/eefuR5zztb/XPOwy6b6IYjDXT0dKQwkFp7m7cls5uYY+voP YtJFCWn2PL4xPBsI1pTqew7XhQw0z5RmmT16y7yw75ie+4frKtYYk3FtkdwIwlZ9gbFJ NWdshyQpzMfVgW/o5w4+PWA7hb0E8uFHuaxGcv/pSo2oIkDWiBjv9aIyE46XVbjNYTOk n1rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Uadp3riVsDCvNaGlGKbc6XMeKfYWPZFpkn0VmeI2yaE=; b=JMBVC+yvU+jg7sjfAdbnM+26p1dCxgo/tuHx4B8I1OM4WB9DqbmoJt83HkG4pg0lx2 cosGOOqm/7zb30ajdxD/X+yZERXatDFJUYus/IeIxvXAxc8Rq8VgMWkCXSjOf8onW0G9 aqo6Cp8wQPQ06v/doGLcpUJTRWPqx3ruS+yT7jb0uvyVIjfqByuowUEr7QcNZSYUv2aY OG+S//HbXEdMne12PnQ4TwmWhnudVUZLBxlGUBOBg1N/40xNmMQpyuh8Yro5OR1hixg4 rCqt+M5iSUhT5seUgTD38gige5iAj9fBzOckKQUpoHFVjbo19KtMA91bgbREnOP18fM7 O6mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zRKSqDTs; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si8641208edb.200.2021.04.12.14.05.06; Mon, 12 Apr 2021 14:05:31 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=zRKSqDTs; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237301AbhDLJII (ORCPT + 99 others); Mon, 12 Apr 2021 05:08:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:45114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238996AbhDLIzS (ORCPT ); Mon, 12 Apr 2021 04:55:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED8F76127A; Mon, 12 Apr 2021 08:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217675; bh=uxWhrvLsfG6a1PviJMUvVUC2CajiNLdihXsgRFpzYr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zRKSqDTsIVIs/41uIAoldmB4FvOvRw4xnVNy5LrXabXZXUm6rlOpeN8xHCfNbHZjq vxVkaybEuRM/8GZdib8+Cwx9LZDK/YTWIN1VeLK7HsnO6RmjwcRlo5uOv65pa2yRrg 6Azxo0zp1iUQ/Lalj6nU16tc4N3g4cMW05Jr5prs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksandr Loktionov , Arkadiusz Kubalewski , Dave Switzer , Tony Nguyen Subject: [PATCH 5.10 059/188] i40e: Fix sparse errors in i40e_txrx.c Date: Mon, 12 Apr 2021 10:39:33 +0200 Message-Id: <20210412084015.613735423@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arkadiusz Kubalewski commit 12738ac4754ec92a6a45bf3677d8da780a1412b3 upstream. Remove error handling through pointers. Instead use plain int to return value from i40e_run_xdp(...). Previously: - sparse errors were produced during compilation: i40e_txrx.c:2338 i40e_run_xdp() error: (-2147483647) too low for ERR_PTR i40e_txrx.c:2558 i40e_clean_rx_irq() error: 'skb' dereferencing possible ERR_PTR() - sk_buff* was used to return value, but it has never had valid pointer to sk_buff. Returned value was always int handled as a pointer. Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions") Fixes: 2e6893123830 ("i40e: split XDP_TX tail and XDP_REDIRECT map flushing") Signed-off-by: Aleksandr Loktionov Signed-off-by: Arkadiusz Kubalewski Tested-by: Dave Switzer Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2187,8 +2187,7 @@ int i40e_xmit_xdp_tx_ring(struct xdp_buf * @rx_ring: Rx ring being processed * @xdp: XDP buffer containing the frame **/ -static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, - struct xdp_buff *xdp) +static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) { int err, result = I40E_XDP_PASS; struct i40e_ring *xdp_ring; @@ -2227,7 +2226,7 @@ static struct sk_buff *i40e_run_xdp(stru } xdp_out: rcu_read_unlock(); - return ERR_PTR(-result); + return result; } /** @@ -2339,6 +2338,7 @@ static int i40e_clean_rx_irq(struct i40e unsigned int xdp_xmit = 0; bool failure = false; struct xdp_buff xdp; + int xdp_res = 0; #if (PAGE_SIZE < 8192) xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, 0); @@ -2405,12 +2405,10 @@ static int i40e_clean_rx_irq(struct i40e /* At larger PAGE_SIZE, frame_sz depend on len size */ xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, size); #endif - skb = i40e_run_xdp(rx_ring, &xdp); + xdp_res = i40e_run_xdp(rx_ring, &xdp); } - if (IS_ERR(skb)) { - unsigned int xdp_res = -PTR_ERR(skb); - + if (xdp_res) { if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) { xdp_xmit |= xdp_res; i40e_rx_buffer_flip(rx_ring, rx_buffer, size);