[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241016185333.GL2162@kernel.org>
Date: Wed, 16 Oct 2024 19:53:33 +0100
From: Simon Horman <horms@...nel.org>
To: Yue Haibing <yuehaibing@...wei.com>
Cc: anthony.l.nguyen@...el.com, przemyslaw.kitszel@...el.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, ast@...nel.org, daniel@...earbox.net,
hawk@...nel.org, john.fastabend@...il.com, vedang.patel@...el.com,
andre.guedes@...el.com, maciej.fijalkowski@...el.com,
jithu.joseph@...el.com, intel-wired-lan@...ts.osuosl.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH net] igc: Fix passing 0 to ERR_PTR in igc_xdp_run_prog()
On Wed, Oct 16, 2024 at 06:53:10PM +0800, Yue Haibing wrote:
> Return NULL instead of passing to ERR_PTR while res is IGC_XDP_PASS,
> which is zero, this fix smatch warnings:
> drivers/net/ethernet/intel/igc/igc_main.c:2533
> igc_xdp_run_prog() warn: passing zero to 'ERR_PTR'
>
> Fixes: 26575105d6ed ("igc: Add initial XDP support")
> Signed-off-by: Yue Haibing <yuehaibing@...wei.com>
> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 6e70bca15db1..c3d6e20c0be0 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -2530,7 +2530,7 @@ static struct sk_buff *igc_xdp_run_prog(struct igc_adapter *adapter,
> res = __igc_xdp_run_prog(adapter, prog, xdp);
>
> out:
> - return ERR_PTR(-res);
> + return res ? ERR_PTR(-res) : NULL;
I think this is what PTR_ERR_OR_ZERO() is for.
Powered by blists - more mailing lists