lkml.org 
[lkml]   [2020]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] dpaa_eth: Fix comparing pointer to 0
From
Date
> 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

\
 
 \ /
  Last update: 2020-04-27 13:27    [W:0.023 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site