netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: paul.burton@imgtec.com
Cc: florian@openwrt.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: ti: cpmac: Fix compiler warning due to type confusion
Date: Sun, 04 Sep 2016 11:48:01 -0700 (PDT)	[thread overview]
Message-ID: <20160904.114801.938788018799814156.davem@davemloft.net> (raw)
In-Reply-To: <20160902142248.3553-1-paul.burton@imgtec.com>

From: Paul Burton <paul.burton@imgtec.com>
Date: Fri, 2 Sep 2016 15:22:48 +0100

> cpmac_start_xmit() used the max() macro on skb->len (an unsigned int)
> and ETH_ZLEN (a signed int literal). This led to the following compiler
> warning:
> 
>   In file included from include/linux/list.h:8:0,
>                    from include/linux/module.h:9,
>                    from drivers/net/ethernet/ti/cpmac.c:19:
>   drivers/net/ethernet/ti/cpmac.c: In function 'cpmac_start_xmit':
>   include/linux/kernel.h:748:17: warning: comparison of distinct pointer
>   types lacks a cast
>     (void) (&_max1 == &_max2);  \
>                    ^
>   drivers/net/ethernet/ti/cpmac.c:560:8: note: in expansion of macro 'max'
>     len = max(skb->len, ETH_ZLEN);
>           ^
> 
> On top of this, it assigned the result of the max() macro to a signed
> integer whilst all further uses of it result in it being cast to varying
> widths of unsigned integer.
> 
> Fix this up by using max_t to ensure the comparison is performed as
> unsigned integers, and for consistency change the type of the len
> variable to unsigned int.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>

Applied.

      reply	other threads:[~2016-09-04 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 14:22 [PATCH] net: ti: cpmac: Fix compiler warning due to type confusion Paul Burton
2016-09-04 18:48 ` David Miller [this message]

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=20160904.114801.938788018799814156.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=florian@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.burton@imgtec.com \
    /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;
as well as URLs for NNTP newsgroup(s).