[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170516224611.GJ17314@wotan.suse.de>
Date: Wed, 17 May 2017 00:46:11 +0200
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Ingo Molnar <mingo@...nel.org>, Mel Gorman <mgorman@...e.de>,
Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>,
Jessica Yu <jeyu@...hat.com>,
Rusty Russell <rusty@...tcorp.com.au>,
Steven Whitehouse <swhiteho@...hat.com>,
deepa.kernel@...il.com, Matt Fleming <matt@...eblueprint.co.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Borislav Petkov <bp@...e.de>,
Dmitry Torokhov <dmitry.torokhov@...il.com>, shuah@...nel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Guenter Roeck <linux@...ck-us.net>,
linux-kselftest@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 7/9] test_sysctl: add simple proc_dointvec() case
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 <mcgrof@...nel.org> 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
Powered by blists - more mailing lists