[<prev] [next>] [day] [month] [year] [list]
Message-ID: <332befc4-efd1-9303-7c9d-f7f3809cd81e@web.de>
Date: Mon, 27 Apr 2020 13:26:45 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Aishwarya Ramakrishnan <aishwaryarj100@...il.com>,
netdev@...r.kernel.org, Coccinelle <cocci@...teme.lip6.fr>
Cc: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Madalin Bucur <madalin.bucur@....com>
Subject: Re: [PATCH] dpaa_eth: Fix comparing pointer to 0
> Fixes coccicheck warning:
> ./drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2110:30-31:
> WARNING comparing pointer to 0
Such information is actually provided by a known script for
the semantic patch language.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/scripts/coccinelle/null/badzero.cocci
> Avoid pointer type value compared to 0.
But I suggest to reconsider corresponding software development consequences
also around mentioned implementation details.
…
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -2107,7 +2107,7 @@ static int dpaa_a050385_wa(struct net_device *net_dev, struct sk_buff **s)
…
> start = PTR_ALIGN(new_skb->data, DPAA_A050385_ALIGN);
> - if (start - new_skb->data != 0)
> + if (start - new_skb->data)
> skb_reserve(new_skb, start - new_skb->data);
…
I interpret the source code in the way that a subtraction is performed
with two pointers. I would expect that such a pointer difference
has got an integral data type.
Will this view trigger any further software evolution?
Regards,
Markus
Powered by blists - more mailing lists