[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00975c56-da9a-2583-ac42-ae6a83e40050@canonical.com>
Date: Tue, 19 Oct 2021 05:39:22 -0600
From: Tim Gardner <tim.gardner@...onical.com>
To: Karsten Graul <kgraul@...ux.ibm.com>, linux-s390@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH][linux-next] net/smc: prevent NULL dereference in
smc_find_rdma_v2_device_serv()
On 10/19/21 12:33 AM, Karsten Graul wrote:
> On 18/10/2021 20:31, Tim Gardner wrote:
>> Coverity complains of a possible NULL dereference in smc_find_rdma_v2_device_serv().
>>
>> 1782 smc_v2_ext = smc_get_clc_v2_ext(pclc);
>> CID 121151 (#1 of 1): Dereference null return value (NULL_RETURNS)
>> 5. dereference: Dereferencing a pointer that might be NULL smc_v2_ext when calling smc_clc_match_eid. [show details]
>> 1783 if (!smc_clc_match_eid(ini->negotiated_eid, smc_v2_ext, NULL, NULL))
>> 1784 goto not_found;
>>
>> Fix this by checking for NULL.
>
> Hmm that's a fundamental question for me: do we want to make the code checkers happy?
> While I understand that those warnings give an uneasy feeling I am not sure
> if the code should have additional (unneeded) checks only to avoid them.
>
Coverity produces a lot of false positives. I thought this one might be
legitimate, but if you're comfortable that its not an issue then I'm OK
with that.
> In this case all NULL checks are initially done in smc_listen_v2_check(),
> afterwards no more NULL checks are needed. When we would like to add them
> then a lot more checks are needed, e.g. 3 times in smc_find_ism_v2_device_serv()
> (not sure why coverity does not complain about them, too).
>
> Thoughts?
>
Coverity probably has produced a report from the other call sites if
you've used a similar pattern, I just hadn't gotten to them yet.
I'll just mark them all as false positives.
rtg
--
-----------
Tim Gardner
Canonical, Inc
Powered by blists - more mailing lists