[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100914082506.GA2201@osiris.boeblingen.de.ibm.com>
Date: Tue, 14 Sep 2010 10:25:06 +0200
From: Heiko Carstens <heiko.carstens@...ibm.com>
To: Stephen Boyd <sboyd@...eaurora.org>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>,
Russell King <linux@....linux.org.uk>,
linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2] ARM: uaccess: Implement strict user copy checks
On Mon, Sep 13, 2010 at 08:07:52PM -0700, Stephen Boyd wrote:
> Ok, I wasn't aware that only x86_32 has support for user copy checks. So
> I hacked support for that on x86_64 and then saw the kprobes.c failure.
> Great! Now for the weird(?) part.
>
> Changing the buf_size variable from an int to a size_t makes the warning
> go away. Perhaps this is because gcc can't reliably eliminate the else
> case when the lower bound isn't 0? Overflow? I'm not really sure. Does
> the kernel/kprobes.c part of this patch work for you?
>
[...]
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 282035f..fa4e0f9 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1967,7 +1967,7 @@ static ssize_t write_enabled_file_bool(struct file *file,
> const char __user *user_buf, size_t count, loff_t *ppos)
> {
> char buf[32];
> - int buf_size;
> + size_t buf_size;
>
> buf_size = min(count, (sizeof(buf)-1));
> if (copy_from_user(buf, user_buf, buf_size))
Yes, the warning goes away on s390 as well.
--
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