lkml.org 
[lkml]   [2018]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 06/21] powerpc: Avoid comparison of unsigned long >= 0 in __access_ok
On Mon, Feb 26, 2018 at 09:00:09PM +0100, christophe leroy wrote:
> Le 26/02/2018 à 18:50, Mathieu Malaterre a écrit :
> >On Mon, Feb 26, 2018 at 8:44 AM, Mathieu Malaterre <malat@debian.org>
> >wrote:
> >>On Mon, Feb 26, 2018 at 7:50 AM, Christophe LEROY
> >><christophe.leroy@c-s.fr> wrote:
> >>>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

\
 
 \ /
  Last update: 2018-02-26 23:19    [W:0.191 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site