fs/fat/fat_test.c:261:9: sparse: sparse: incorrect type in initializer (different base types)
From: kernel test robot
Date: Mon Jun 01 2026 - 12:42:07 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e43ffb69e0438cddd72aaa30898b4dc446f664f8
commit: 4bbf3f58e00f8671eb384c7df6983d803058b204 fat: add KUnit tests for timestamp conversion helpers
date: 10 weeks ago
config: m68k-randconfig-r111-20260601 (https://download.01.org/0day-ci/archive/20260602/202606020036.nW4hUG3I-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606020036.nW4hUG3I-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 4bbf3f58e00f ("fat: add KUnit tests for timestamp conversion helpers")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606020036.nW4hUG3I-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> fs/fat/fat_test.c:261:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long left_value @@ got restricted __le16 const __left @@
fs/fat/fat_test.c:261:9: sparse: expected long long left_value
fs/fat/fat_test.c:261:9: sparse: got restricted __le16 const __left
fs/fat/fat_test.c:261:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long right_value @@ got restricted __le16 const __right @@
fs/fat/fat_test.c:261:9: sparse: expected long long right_value
fs/fat/fat_test.c:261:9: sparse: got restricted __le16 const __right
fs/fat/fat_test.c:265:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long left_value @@ got restricted __le16 const __left @@
fs/fat/fat_test.c:265:9: sparse: expected long long left_value
fs/fat/fat_test.c:265:9: sparse: got restricted __le16 const __left
fs/fat/fat_test.c:265:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long right_value @@ got restricted __le16 const __right @@
fs/fat/fat_test.c:265:9: sparse: expected long long right_value
fs/fat/fat_test.c:265:9: sparse: got restricted __le16 const __right
fs/fat/fat_test.c:286:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long left_value @@ got restricted __le16 const __left @@
fs/fat/fat_test.c:286:9: sparse: expected long long left_value
fs/fat/fat_test.c:286:9: sparse: got restricted __le16 const __left
fs/fat/fat_test.c:286:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long right_value @@ got restricted __le16 const __right @@
fs/fat/fat_test.c:286:9: sparse: expected long long right_value
fs/fat/fat_test.c:286:9: sparse: got restricted __le16 const __right
fs/fat/fat_test.c:290:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long left_value @@ got restricted __le16 const __left @@
fs/fat/fat_test.c:290:9: sparse: expected long long left_value
fs/fat/fat_test.c:290:9: sparse: got restricted __le16 const __left
fs/fat/fat_test.c:290:9: sparse: sparse: incorrect type in initializer (different base types) @@ expected long long right_value @@ got restricted __le16 const __right @@
fs/fat/fat_test.c:290:9: sparse: expected long long right_value
fs/fat/fat_test.c:290:9: sparse: got restricted __le16 const __right
vim +261 fs/fat/fat_test.c
b0d4adaf3b3c44 David Gow 2021-04-15 248
b0d4adaf3b3c44 David Gow 2021-04-15 249 static void fat_time_unix2fat_test(struct kunit *test)
b0d4adaf3b3c44 David Gow 2021-04-15 250 {
b0d4adaf3b3c44 David Gow 2021-04-15 251 static struct msdos_sb_info fake_sb;
b0d4adaf3b3c44 David Gow 2021-04-15 252 __le16 date, time;
b0d4adaf3b3c44 David Gow 2021-04-15 253 u8 cs;
b0d4adaf3b3c44 David Gow 2021-04-15 254 struct fat_timestamp_testcase *testcase =
b0d4adaf3b3c44 David Gow 2021-04-15 255 (struct fat_timestamp_testcase *)test->param_value;
b0d4adaf3b3c44 David Gow 2021-04-15 256
4bbf3f58e00f86 avivdaum 2026-03-16 257 fat_test_set_time_offset(&fake_sb, testcase->time_offset);
b0d4adaf3b3c44 David Gow 2021-04-15 258
b0d4adaf3b3c44 David Gow 2021-04-15 259 fat_time_unix2fat(&fake_sb, &testcase->ts,
b0d4adaf3b3c44 David Gow 2021-04-15 260 &time, &date, &cs);
b0d4adaf3b3c44 David Gow 2021-04-15 @261 KUNIT_EXPECT_EQ_MSG(test,
4bbf3f58e00f86 avivdaum 2026-03-16 262 testcase->time,
4bbf3f58e00f86 avivdaum 2026-03-16 263 time,
b0d4adaf3b3c44 David Gow 2021-04-15 264 "Time mismatch\n");
b0d4adaf3b3c44 David Gow 2021-04-15 265 KUNIT_EXPECT_EQ_MSG(test,
4bbf3f58e00f86 avivdaum 2026-03-16 266 testcase->date,
4bbf3f58e00f86 avivdaum 2026-03-16 267 date,
b0d4adaf3b3c44 David Gow 2021-04-15 268 "Date mismatch\n");
b0d4adaf3b3c44 David Gow 2021-04-15 269 KUNIT_EXPECT_EQ_MSG(test,
b0d4adaf3b3c44 David Gow 2021-04-15 270 testcase->cs,
b0d4adaf3b3c44 David Gow 2021-04-15 271 cs,
b0d4adaf3b3c44 David Gow 2021-04-15 272 "Centisecond mismatch\n");
b0d4adaf3b3c44 David Gow 2021-04-15 273 }
b0d4adaf3b3c44 David Gow 2021-04-15 274
:::::: The code at line 261 was first introduced by commit
:::::: b0d4adaf3b3c4402d9c3b6186e02aa1e4f7985cd fat: Add KUnit tests for checksums and timestamps
:::::: TO: David Gow <davidgow@xxxxxxxxxx>
:::::: CC: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki