* [PATCH] net: caif: remove redundant null check on frontpkt
@ 2018-09-14 17:19 Colin King
2018-09-14 17:54 ` Sergei Shtylyov
2018-09-18 1:50 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2018-09-14 17:19 UTC (permalink / raw)
To: Dmitry Tarnyagin, David S . Miller; +Cc: kernel-janitors, netdev
From: Colin Ian King <colin.king@canonical.com>
It is impossible for frontpkt to be null at the point of the null
check because it has been assigned from rearpkt and there is no
way realpkt can be null at the point of the assignment because
of the sanity checking and exit paths taken previously. Remove
the redundant null check.
Detected by CoverityScan, CID#114434 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
net/caif/cfrfml.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c
index b82440e1fcb4..a931a71ef6df 100644
--- a/net/caif/cfrfml.c
+++ b/net/caif/cfrfml.c
@@ -264,9 +264,6 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
frontpkt = rearpkt;
rearpkt = NULL;
- err = -ENOMEM;
- if (frontpkt == NULL)
- goto out;
err = -EPROTO;
if (cfpkt_add_head(frontpkt, head, 6) < 0)
goto out;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] net: caif: remove redundant null check on frontpkt
2018-09-14 17:19 [PATCH] net: caif: remove redundant null check on frontpkt Colin King
@ 2018-09-14 17:54 ` Sergei Shtylyov
2018-09-14 18:18 ` Colin Ian King
2018-09-18 1:50 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2018-09-14 17:54 UTC (permalink / raw)
To: Colin King, Dmitry Tarnyagin, David S . Miller; +Cc: kernel-janitors, netdev
Hello!
On 09/14/2018 08:19 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> It is impossible for frontpkt to be null at the point of the null
> check because it has been assigned from rearpkt and there is no
> way realpkt can be null at the point of the assignment because
rearpkt?
> of the sanity checking and exit paths taken previously. Remove
> the redundant null check.
>
> Detected by CoverityScan, CID#114434 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] net: caif: remove redundant null check on frontpkt
2018-09-14 17:54 ` Sergei Shtylyov
@ 2018-09-14 18:18 ` Colin Ian King
0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2018-09-14 18:18 UTC (permalink / raw)
To: Sergei Shtylyov, Dmitry Tarnyagin, David S . Miller
Cc: kernel-janitors, netdev
On 14/09/18 18:54, Sergei Shtylyov wrote:
> Hello!
>
> On 09/14/2018 08:19 PM, Colin King wrote:
>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> It is impossible for frontpkt to be null at the point of the null
>> check because it has been assigned from rearpkt and there is no
>> way realpkt can be null at the point of the assignment because
>
> rearpkt?
Good spot. Can this be fixed up when the patch is applied?
>
>> of the sanity checking and exit paths taken previously. Remove
>> the redundant null check.
>>
>> Detected by CoverityScan, CID#114434 ("Logically dead code")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> [...]
>
> MBR, Sergei
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: caif: remove redundant null check on frontpkt
2018-09-14 17:19 [PATCH] net: caif: remove redundant null check on frontpkt Colin King
2018-09-14 17:54 ` Sergei Shtylyov
@ 2018-09-18 1:50 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-09-18 1:50 UTC (permalink / raw)
To: colin.king; +Cc: dmitry.tarnyagin, kernel-janitors, netdev
From: Colin King <colin.king@canonical.com>
Date: Fri, 14 Sep 2018 18:19:16 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> It is impossible for frontpkt to be null at the point of the null
> check because it has been assigned from rearpkt and there is no
> way realpkt can be null at the point of the assignment because
> of the sanity checking and exit paths taken previously. Remove
> the redundant null check.
>
> Detected by CoverityScan, CID#114434 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Appied to net-next with typo fixed.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-18 7:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-14 17:19 [PATCH] net: caif: remove redundant null check on frontpkt Colin King
2018-09-14 17:54 ` Sergei Shtylyov
2018-09-14 18:18 ` Colin Ian King
2018-09-18 1:50 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox