Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754231AbbHXM1q (ORCPT ); Mon, 24 Aug 2015 08:27:46 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:48380 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbbHXM1o (ORCPT ); Mon, 24 Aug 2015 08:27:44 -0400 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 From: "Eric W. Biederman" Date: Mon, 24 Aug 2015 05:27:35 -0700 To: Sean Fu , Andrey Ryabinin , Ulrich Obergfell , "Steven Rostedt (Red Hat)" , Prarit Bhargava , Eric B Munson , "Paul E. McKenney" , Johannes Weiner CC: Andrew Morton , Thomas Gleixner , Don Zickus , Heinrich Schuchardt , David Rientjes , linux-kernel@vger.kernel.org Message-ID: X-XM-AID: U2FsdGVkX18BM0DaVAwADmDJQlo8fTDWajvlJzsHoyE= X-SA-Exim-Connect-IP: 209.53.166.186 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.6 TooManyTo_003 Multiple "To" Header Recipients 4x (uncommon) * 0.5 TooManyTo_002 Multiple "To" Header Recipients 3x (uncommon) * 0.4 TooManyTo_005 Multiple "To" Header Recipients 6x (uncommon) * 0.3 TooManyTo_001 Multiple "To" Header Recipients 2x (uncommon) * 0.5 TooManyTo_004 Multiple "To" Header Recipients 5x (uncommon) * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5003] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Sean Fu ,Andrey Ryabinin ,Ulrich Obergfell ,"Steven Rostedt (Red Hat)" ,Prarit Bhargava , Eric B Munson ,"Paul E. McKenney" ,Johannes Weiner X-Spam-Relay-Country: X-Spam-Timing: total 400 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 4.2 (1.1%), b_tie_ro: 3.1 (0.8%), parse: 1.01 (0.3%), extract_message_metadata: 3.4 (0.9%), get_uri_detail_list: 1.49 (0.4%), tests_pri_-1000: 3.9 (1.0%), tests_pri_-950: 1.26 (0.3%), tests_pri_-900: 1.09 (0.3%), tests_pri_-400: 19 (4.8%), check_bayes: 18 (4.4%), b_tokenize: 5 (1.4%), b_tok_get_all: 5 (1.3%), b_comp_prob: 1.85 (0.5%), b_tok_touch_all: 2.6 (0.6%), b_finish: 0.74 (0.2%), tests_pri_0: 349 (87.1%), tests_pri_500: 6 (1.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1385 Lines: 45 On August 24, 2015 1:56:13 AM PDT, Sean Fu wrote: >when the input argument "count" including the terminating byte "\0", >The write system call return EINVAL on proc file. >But it return success on regular file. Nonsense. It will write the '\0' to a regular file because it is just data. Integers in proc are more than data. So I see no justification for this change. Eric >E.g. Writting two bytes ("1\0") to >"/proc/sys/net/ipv4/conf/eth0/rp_filter". >write(fd, "1\0", 2) return EINVAL. > >Signed-off-by: Sean Fu >--- > kernel/sysctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/kernel/sysctl.c b/kernel/sysctl.c >index 19b62b5..c2b0594 100644 >--- a/kernel/sysctl.c >+++ b/kernel/sysctl.c >@@ -2004,7 +2004,7 @@ static int do_proc_dointvec_conv(bool *negp, >unsigned long *lvalp, > return 0; > } > >-static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; >+static const char proc_wspace_sep[] = { ' ', '\t', '\n', '\0' }; > > static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, > int write, void __user *buffer, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/