Re: [PATCH] compat: fix possible out-of-bound accesses in compat_get_bitmap() and compat_put_bitmap()

From: Linus Torvalds
Date: Sat Jun 06 2015 - 12:13:56 EST


On Fri, Jun 5, 2015 at 11:24 AM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Yes, but... if we decrement that sucker at all, why do we need to play with
> i at all? We need exactly nr_compat_longs get_user(), so why not make _that_
> the condition in the single-level loop?

Yeah, I think that code could be clarified further, no argument there.

And wee could just do it the copy in compat_long_t directly on
little-endian and get rid of the complications entirely, but then we'd
have the worry of separate code for big-endian, so I guess that's not
worth it (it's not like this should be hugely performance-sensitive).

I think most of that code falls under "don't touch it if it ain't
broke", with the corollary being "touch it as little as possible even
when it is broke"

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/