Re: [PATCH net-next v2] net/ipv6: silence 'passing zero to ERR_PTR()' warning

From: David Ahern
Date: Tue Apr 18 2023 - 16:46:40 EST


On 4/17/23 8:17 PM, Jakub Kicinski wrote:
> On Fri, 14 Apr 2023 09:32:51 +0300 Dan Carpenter wrote:
>> Also it can return NULL.
>>
>> net/xfrm/xfrm_policy.c
>> 3229 dst = dst_orig;
>> 3230 }
>> 3231 ok:
>> 3232 xfrm_pols_put(pols, drop_pols);
>> 3233 if (dst && dst->xfrm &&
>> ^^^
>> "dst" is NULL.
>
> Don't take my word for it, but AFAICT it's impossible to get there with
> dst == NULL. I think we can remove this check instead if that's what
> makes smatch infer that dst may be NULL.
>

That was my conclusion as well staring at it multiple times, but given
the horrible maze of goto's I cannot definitively say that.