On Mon, Feb 26, 2018 at 09:00:09PM +0100, christophe leroy wrote:
Le 26/02/2018 à 18:50, Mathieu Malaterre a écrit :
quoted
On Mon, Feb 26, 2018 at 8:44 AM, Mathieu Malaterre [off-list ref]
wrote:
quoted
On Mon, Feb 26, 2018 at 7:50 AM, Christophe LEROY
[off-list ref] wrote:
quoted
Note that I already try to submit a fix for this warning 3 years ago
(https://patchwork.ozlabs.org/patch/418075/) and it was rejected with the
following comment:
Tested again today with gcc 6.3.0 and gcc is still producing the
original warning (treated as error).
That's right, it seems that recent versions of gcc are not happy anymore
with that change.
Maybe Segher has a suggestion for that one ?
Your patch:
#define __access_ok(addr, size, segment) \
(((addr) <= (segment).seg) && \
- (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
+ (((size) <= 1) || (((size) - 1) <= ((segment).seg - (addr)))))
Is there any reason to write this as a macro? Let's make this more
readable:
static inline int __access_ok(unsigned long addr, unsigned long size,
mm_segment_t seg)
{
if (addr > seg.seg)
return 0;
return (size == 0 || size - 1 <= seg.seg - addr);
}
and I think we are done already, or will this warn for any input?
Segher