lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 04 Sep 2016 11:48:01 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     paul.burton@...tec.com
Cc:     florian@...nwrt.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: ti: cpmac: Fix compiler warning due to type
 confusion

From: Paul Burton <paul.burton@...tec.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@...tec.com>

Applied.

Powered by blists - more mailing lists