From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068AbdEPWqQ (ORCPT ); Tue, 16 May 2017 18:46:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:33166 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751342AbdEPWqO (ORCPT ); Tue, 16 May 2017 18:46:14 -0400 Date: Wed, 17 May 2017 00:46:11 +0200 From: "Luis R. Rodriguez" To: Kees Cook Cc: "Luis R. Rodriguez" , Al Viro , Andrew Morton , "Eric W. Biederman" , Arnaldo Carvalho de Melo , Ingo Molnar , Mel Gorman , Subash Abhinov Kasiviswanathan , Jessica Yu , Rusty Russell , Steven Whitehouse , deepa.kernel@gmail.com, Matt Fleming , Alexey Dobriyan , Borislav Petkov , Dmitry Torokhov , shuah@kernel.org, Linus Torvalds , Guenter Roeck , linux-kselftest@vger.kernel.org, LKML Subject: Re: [PATCH v2 7/9] test_sysctl: add simple proc_dointvec() case Message-ID: <20170516224611.GJ17314@wotan.suse.de> References: <20170209012853.GJ24047@wotan.suse.de> <20170211003614.6579-1-mcgrof@kernel.org> <20170211003614.6579-8-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 13, 2017 at 02:00:13PM -0800, Kees Cook wrote: > On Fri, Feb 10, 2017 at 4:36 PM, Luis R. Rodriguez wrote: > > diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh > > index 14b9d875db42..45fd2ee5739c 100755 > > --- a/tools/testing/selftests/sysctl/sysctl.sh > > +++ b/tools/testing/selftests/sysctl/sysctl.sh > > @@ -24,6 +24,7 @@ TEST_FILE=$(mktemp) > > @@ -261,6 +268,48 @@ run_limit_digit() > > test_rc > > } > > > > +# You are using an int > > +run_limit_digit_int() > > +{ > > + echo -n "Testing INT_MAX works ..." > > + reset_vals > > + TEST_STR="$INT_MAX" > > + echo -n $TEST_STR > $TARGET > > + > > + if ! verify "${TARGET}"; then > > + echo "FAIL" >&2 > > + rc=1 > > + else > > + echo "ok" > > + fi > > + test_rc > > + > > + echo -n "Testing INT_MAX + 1 will fail as expected..." > > + reset_vals > > + TEST_STR=$(($INT_MAX+1)) > > Is the shell always going to do the right thing here? Maybe these test > values should be explicitly hard-coded? I'm on the fence... Will use the good 'ol time tested: let TEST_STR=$INT_MAX+1 I had used it for all other sums before, not sure why I went short-cut mode. Either way this is requiring /bin/bash at the top header, but yeah not sure when that short cut mode addition was added to bash. Better to be both safe and consistent. Luis