[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <874nooc7wd.fsf@xmission.com>
Date: Tue, 31 Jul 2012 07:38:58 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: David Howells <dhowells@...hat.com>
Cc: Mitsuo Hayasaka <mitsuo.hayasaka.hu@...achi.com>,
Andrew Morton <akpm@...ux-foundation.org>,
James Morris <james.l.morris@...cle.com>,
linux-kernel@...r.kernel.org, yrl.pp-manager.tt@...achi.com
Subject: Re: [PATCH] sysctl: fix improper indication of integer sysctl parameter
David Howells <dhowells@...hat.com> writes:
> Mitsuo Hayasaka <mitsuo.hayasaka.hu@...achi.com> wrote:
>
>> When we read the sysctl parameter, they are always treated
>> as signed integer, and are casted into unsigned long type
>> in the current kernel. If we set a value equivalent to
>> (the maximum value in signed integer + 1)
>
> Wouldn't it be better to return EINVAL or EDOM?
Yes we should definitely fail the write in the case where we write an
unsigned value and we can not fit that value in an integer.
There will still remain the bug of reading the integer
where (-val == val) && val < 0. In that case we do want to an
(unsigned int) before storing it in an unsinged long.
The decription of the patch is confusing.
The problem is not the cast to unsigned long, the problem is
the implicit cast to signed long which happens before the cast
to unsigned long. I think this is a case where C's casting rules
get it wrong. If I have an explicit cast why add an implicit
cast to do sign extension. Sigh.
Mitsuo since you are looking at this do you think you could fix the
write side of the problem as well, and check to make cetain the
unsigned value we write will fit in an interger.
Eric
--
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