From: Markus Elfring <Markus.Elfring@web.de>
To: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>,
netdev@vger.kernel.org, Coccinelle <cocci@systeme.lip6.fr>
Cc: linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Madalin Bucur <madalin.bucur@nxp.com>
Subject: Re: [PATCH] dpaa_eth: Fix comparing pointer to 0
Date: Mon, 27 Apr 2020 13:26:45 +0200 [thread overview]
Message-ID: <332befc4-efd1-9303-7c9d-f7f3809cd81e@web.de> (raw)
> 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
next reply other threads:[~2020-04-27 11:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 11:26 Markus Elfring [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-27 10:32 Aishwarya Ramakrishnan
2020-05-01 3:26 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=332befc4-efd1-9303-7c9d-f7f3809cd81e@web.de \
--to=markus.elfring@web.de \
--cc=aishwaryarj100@gmail.com \
--cc=cocci@systeme.lip6.fr \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®