Re: [PATCH 3/3] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

From: Linus Torvalds
Date: Fri Apr 07 2017 - 12:49:37 EST


On Fri, Apr 7, 2017 at 8:51 AM, Liping Zhang <zlpnobody@xxxxxxx> wrote:
> From: Liping Zhang <zlpnobody@xxxxxxxxx>
>
> Currently, inputting the following command will succeed but actually the
> value will be truncated:
> # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat
>
> This is not friendly to the user, so instead, we should report error
> when the value is larger than UINT_MAX.

I applied the two other patches, but I didn't apply this one.

It's entirely possible that people end up doing something like

echo -1 > /proc/sys/some_random_uint

because that's a fairly normal thing to do to set all bits. Making
that an error seems wrong.

Linus