From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756669AbdDGVG5 (ORCPT ); Fri, 7 Apr 2017 17:06:57 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:41688 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756528AbdDGVGt (ORCPT ); Fri, 7 Apr 2017 17:06:49 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Liping Zhang , Andrew Morton , Ingo Molnar , David Miller , Subash Abhinov Kasiviswanathan , Linux Kernel Mailing List , Liping Zhang References: <1491580267-36340-1-git-send-email-zlpnobody@163.com> <1491580267-36340-4-git-send-email-zlpnobody@163.com> Date: Fri, 07 Apr 2017 16:01:16 -0500 In-Reply-To: (Linus Torvalds's message of "Fri, 7 Apr 2017 09:49:25 -0700") Message-ID: <87k26w0w6b.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cwb5a-0008J6-L6;;;mid=<87k26w0w6b.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.234.240;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+4uneIgLfMYHh/dFy6m/T5UT2N0JpuYt4= X-SA-Exim-Connect-IP: 67.3.234.240 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 BAYES_20 BODY: Bayes spam probability is 5 to 20% * [score: 0.0508] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 XMSubMetaSx_00 1+ Sexy Words X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 5320 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.1 (0.1%), b_tie_ro: 2.2 (0.0%), parse: 1.29 (0.0%), extract_message_metadata: 26 (0.5%), get_uri_detail_list: 2.1 (0.0%), tests_pri_-1000: 9 (0.2%), tests_pri_-950: 2.0 (0.0%), tests_pri_-900: 1.63 (0.0%), tests_pri_-400: 29 (0.5%), check_bayes: 27 (0.5%), b_tokenize: 10 (0.2%), b_tok_get_all: 8 (0.1%), b_comp_prob: 3.9 (0.1%), b_tok_touch_all: 2.2 (0.0%), b_finish: 0.78 (0.0%), tests_pri_0: 377 (7.1%), check_dkim_signature: 1.62 (0.0%), check_dkim_adsp: 4.4 (0.1%), tests_pri_500: 4864 (91.4%), poll_dns_idle: 4856 (91.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 3/3] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > On Fri, Apr 7, 2017 at 8:51 AM, Liping Zhang wrote: >> From: Liping Zhang >> >> 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. Except that doesn't help in this case. The function do_uintvec_conv rules already rejects all negative values on write. So -1 is already rejected. In fact the function proc_douintvec_conv has always rejected negative values so this change won't even create a regression. So it looks perfectly reasonable to reject values that are simply too large to be written to the uint. So even today to write all bits set you do have to do: echo 0xffffffff > /proc/sys/some_random_uint Eric