* [kbuild:kunit 16/17] kernel/sysctl-test.c:185:37: warning: integer overflow in expression of type 'long int' results in '2147483647'
@ 2019-05-10 6:12 kbuild test robot
0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2019-05-10 6:12 UTC (permalink / raw)
To: Iurii Zaikin; +Cc: kbuild-all, linux-kbuild, Masahiro Yamada, Brendan Higgins
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-10 6:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-10 6:12 [kbuild:kunit 16/17] kernel/sysctl-test.c:185:37: warning: integer overflow in expression of type 'long int' results in '2147483647' kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox