From: kbuild test robot <lkp@intel.com>
To: Iurii Zaikin <yzaikin@google.com>
Cc: kbuild-all@01.org, linux-kbuild@vger.kernel.org,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Brendan Higgins <brendanhiggins@google.com>
Subject: [kbuild:kunit 16/17] kernel/sysctl-test.c:185:37: warning: integer overflow in expression of type 'long int' results in '2147483647'
Date: Fri, 10 May 2019 14:12:47 +0800 [thread overview]
Message-ID: <201905101444.igDoqUpQ%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2598 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kunit
head: c505c0b2e6237c729634327c178f5b0094f1c958
commit: b3c54f027d78b71240b2572cf2dabb3381aa68de [16/17] kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout b3c54f027d78b71240b2572cf2dabb3381aa68de
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
kernel/sysctl-test.c: In function 'sysctl_test_dointvec_single_less_int_min':
>> kernel/sysctl-test.c:185:37: warning: integer overflow in expression of type 'long int' results in '2147483647' [-Woverflow]
long less_than_min = (long)INT_MIN - 1;
^
kernel/sysctl-test.c: In function 'sysctl_test_dointvec_single_greater_int_max':
kernel/sysctl-test.c:213:40: warning: integer overflow in expression of type 'long int' results in '-2147483648' [-Woverflow]
long greater_than_max = (long)INT_MAX + 1;
^
vim +185 kernel/sysctl-test.c
170
171 static void sysctl_test_dointvec_single_less_int_min(struct kunit *test)
172 {
173 struct ctl_table table = {
174 .procname = "foo",
175 .data = &test_data.int_0001,
176 .maxlen = sizeof(int),
177 .mode = 0644,
178 .proc_handler = proc_dointvec,
179 .extra1 = &i_zero,
180 .extra2 = &i_one_hundred,
181 };
182 char input[32];
183 size_t len = sizeof(input) - 1;
184 loff_t pos = 0;
> 185 long less_than_min = (long)INT_MIN - 1;
186
187 KUNIT_EXPECT_LT(test, less_than_min, INT_MIN);
188 KUNIT_EXPECT_LT(test,
189 snprintf(input, sizeof(input), "%ld", less_than_min),
190 sizeof(input));
191
192 table.data = kunit_kzalloc(test, sizeof(int), GFP_USER);
193 KUNIT_EXPECT_EQ(test, -EINVAL,
194 proc_dointvec(&table, 1, input, &len, &pos));
195 KUNIT_EXPECT_EQ(test, sizeof(input) - 1, len);
196 KUNIT_EXPECT_EQ(test, 0, *(int *)table.data);
197 }
198
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56784 bytes --]
reply other threads:[~2019-05-10 6:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201905101444.igDoqUpQ%lkp@intel.com \
--to=lkp@intel.com \
--cc=brendanhiggins@google.com \
--cc=kbuild-all@01.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=yamada.masahiro@socionext.com \
--cc=yzaikin@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox