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  linux-hardening  linux-cve-announce  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:	Tue, 22 Apr 2014 16:46:50 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	"LF.Tan" <lftan.linux@...il.com>
cc:	linux-kernel@...r.kernel.org
Subject: Re: min() and max() have warning: comparison of distinct pointer
 types lacks a cast

On Tue, 22 Apr 2014, LF.Tan wrote:

> Hi all
> 
> Have these warning messages when compiling kernel.
> Anyone know what's wrong?
> 
> Regards.
> ----------------------------
> In file included from mm/readahead.c:10:0:
> mm/readahead.c: In function 'max_sane_readahead':
> include/linux/kernel.h:713:17: warning: comparison of distinct pointer
> types lacks a cast [enabled by default]
>   (void) (&_min1 == &_min2);  \
>                  ^
> mm/readahead.c:242:9: note: in expansion of macro 'min'
>   return min(nr, MAX_READAHEAD);
>          ^
> 

In min(nr, MAX_READAHEAD), nr is of type unsigned long and MAX_READAHEAD 
is of type unsigned long or int depending on the arch.  This warns because 
of strict type-checking, otherwise the results could be unexpected when 
comparing unsigned long to signed long, for example.

I don't think fixing this to do min_t() is the right solution since 
PAGE_SIZE is assumbed to be defined to be ul.  Please send your arch and 
.config.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ