From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: kernel/kexec_file.c:320:1: sparse: sparse: Using plain integer as NULL pointer
Date: Sun, 10 Dec 2023 10:34:21 +0800 [thread overview]
Message-ID: <202312101050.6FqHvugR-lkp@intel.com> (raw)
::::::
:::::: Manual check reason: "only kconfig file changed"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: "Jason A. Donenfeld" <zx2c4@kernel.org>
CC: Jakub Kicinski <kuba@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 21b73ffcc62ab772bc06e3e90bd87eff5e9e8ed4
commit: b7133757da4c4c17d625970f6da3d76af12a8867 crypto: s390 - do not depend on CRYPTO_HW for SIMD implementations
date: 1 year, 5 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 1 year, 5 months ago
config: s390-randconfig-r113-20231115 (https://download.01.org/0day-ci/archive/20231210/202312101050.6FqHvugR-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231210/202312101050.6FqHvugR-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202312101050.6FqHvugR-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> kernel/kexec_file.c:320:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/kexec_file.c:320:1: sparse: sparse: Using plain integer as NULL pointer
vim +320 kernel/kexec_file.c
a43cac0d9dc207 Dave Young 2015-09-09 319
a43cac0d9dc207 Dave Young 2015-09-09 @320 SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
a43cac0d9dc207 Dave Young 2015-09-09 321 unsigned long, cmdline_len, const char __user *, cmdline_ptr,
a43cac0d9dc207 Dave Young 2015-09-09 322 unsigned long, flags)
a43cac0d9dc207 Dave Young 2015-09-09 323 {
a43cac0d9dc207 Dave Young 2015-09-09 324 int ret = 0, i;
a43cac0d9dc207 Dave Young 2015-09-09 325 struct kimage **dest_image, *image;
a43cac0d9dc207 Dave Young 2015-09-09 326
a43cac0d9dc207 Dave Young 2015-09-09 327 /* We only trust the superuser with rebooting the system. */
a43cac0d9dc207 Dave Young 2015-09-09 328 if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
a43cac0d9dc207 Dave Young 2015-09-09 329 return -EPERM;
a43cac0d9dc207 Dave Young 2015-09-09 330
a43cac0d9dc207 Dave Young 2015-09-09 331 /* Make sure we have a legal set of flags */
a43cac0d9dc207 Dave Young 2015-09-09 332 if (flags != (flags & KEXEC_FILE_FLAGS))
a43cac0d9dc207 Dave Young 2015-09-09 333 return -EINVAL;
a43cac0d9dc207 Dave Young 2015-09-09 334
a43cac0d9dc207 Dave Young 2015-09-09 335 image = NULL;
a43cac0d9dc207 Dave Young 2015-09-09 336
a43cac0d9dc207 Dave Young 2015-09-09 337 if (!mutex_trylock(&kexec_mutex))
a43cac0d9dc207 Dave Young 2015-09-09 338 return -EBUSY;
a43cac0d9dc207 Dave Young 2015-09-09 339
a43cac0d9dc207 Dave Young 2015-09-09 340 dest_image = &kexec_image;
9b492cf58077a0 Xunlei Pang 2016-05-23 341 if (flags & KEXEC_FILE_ON_CRASH) {
a43cac0d9dc207 Dave Young 2015-09-09 342 dest_image = &kexec_crash_image;
9b492cf58077a0 Xunlei Pang 2016-05-23 343 if (kexec_crash_image)
9b492cf58077a0 Xunlei Pang 2016-05-23 344 arch_kexec_unprotect_crashkres();
9b492cf58077a0 Xunlei Pang 2016-05-23 345 }
a43cac0d9dc207 Dave Young 2015-09-09 346
a43cac0d9dc207 Dave Young 2015-09-09 347 if (flags & KEXEC_FILE_UNLOAD)
a43cac0d9dc207 Dave Young 2015-09-09 348 goto exchange;
a43cac0d9dc207 Dave Young 2015-09-09 349
a43cac0d9dc207 Dave Young 2015-09-09 350 /*
a43cac0d9dc207 Dave Young 2015-09-09 351 * In case of crash, new kernel gets loaded in reserved region. It is
a43cac0d9dc207 Dave Young 2015-09-09 352 * same memory where old crash kernel might be loaded. Free any
a43cac0d9dc207 Dave Young 2015-09-09 353 * current crash dump kernel before we corrupt it.
a43cac0d9dc207 Dave Young 2015-09-09 354 */
a43cac0d9dc207 Dave Young 2015-09-09 355 if (flags & KEXEC_FILE_ON_CRASH)
a43cac0d9dc207 Dave Young 2015-09-09 356 kimage_free(xchg(&kexec_crash_image, NULL));
a43cac0d9dc207 Dave Young 2015-09-09 357
a43cac0d9dc207 Dave Young 2015-09-09 358 ret = kimage_file_alloc_init(&image, kernel_fd, initrd_fd, cmdline_ptr,
a43cac0d9dc207 Dave Young 2015-09-09 359 cmdline_len, flags);
a43cac0d9dc207 Dave Young 2015-09-09 360 if (ret)
a43cac0d9dc207 Dave Young 2015-09-09 361 goto out;
a43cac0d9dc207 Dave Young 2015-09-09 362
a43cac0d9dc207 Dave Young 2015-09-09 363 ret = machine_kexec_prepare(image);
a43cac0d9dc207 Dave Young 2015-09-09 364 if (ret)
a43cac0d9dc207 Dave Young 2015-09-09 365 goto out;
a43cac0d9dc207 Dave Young 2015-09-09 366
1229384f5b856d Xunlei Pang 2017-07-12 367 /*
1229384f5b856d Xunlei Pang 2017-07-12 368 * Some architecture(like S390) may touch the crash memory before
1229384f5b856d Xunlei Pang 2017-07-12 369 * machine_kexec_prepare(), we must copy vmcoreinfo data after it.
1229384f5b856d Xunlei Pang 2017-07-12 370 */
1229384f5b856d Xunlei Pang 2017-07-12 371 ret = kimage_crash_copy_vmcoreinfo(image);
1229384f5b856d Xunlei Pang 2017-07-12 372 if (ret)
1229384f5b856d Xunlei Pang 2017-07-12 373 goto out;
1229384f5b856d Xunlei Pang 2017-07-12 374
a43cac0d9dc207 Dave Young 2015-09-09 375 ret = kexec_calculate_store_digests(image);
a43cac0d9dc207 Dave Young 2015-09-09 376 if (ret)
a43cac0d9dc207 Dave Young 2015-09-09 377 goto out;
a43cac0d9dc207 Dave Young 2015-09-09 378
a43cac0d9dc207 Dave Young 2015-09-09 379 for (i = 0; i < image->nr_segments; i++) {
a43cac0d9dc207 Dave Young 2015-09-09 380 struct kexec_segment *ksegment;
a43cac0d9dc207 Dave Young 2015-09-09 381
a43cac0d9dc207 Dave Young 2015-09-09 382 ksegment = &image->segment[i];
a43cac0d9dc207 Dave Young 2015-09-09 383 pr_debug("Loading segment %d: buf=0x%p bufsz=0x%zx mem=0x%lx memsz=0x%zx\n",
a43cac0d9dc207 Dave Young 2015-09-09 384 i, ksegment->buf, ksegment->bufsz, ksegment->mem,
a43cac0d9dc207 Dave Young 2015-09-09 385 ksegment->memsz);
a43cac0d9dc207 Dave Young 2015-09-09 386
a43cac0d9dc207 Dave Young 2015-09-09 387 ret = kimage_load_segment(image, &image->segment[i]);
a43cac0d9dc207 Dave Young 2015-09-09 388 if (ret)
a43cac0d9dc207 Dave Young 2015-09-09 389 goto out;
a43cac0d9dc207 Dave Young 2015-09-09 390 }
a43cac0d9dc207 Dave Young 2015-09-09 391
a43cac0d9dc207 Dave Young 2015-09-09 392 kimage_terminate(image);
a43cac0d9dc207 Dave Young 2015-09-09 393
de68e4daea9084 Pavel Tatashin 2019-12-04 394 ret = machine_kexec_post_load(image);
de68e4daea9084 Pavel Tatashin 2019-12-04 395 if (ret)
de68e4daea9084 Pavel Tatashin 2019-12-04 396 goto out;
de68e4daea9084 Pavel Tatashin 2019-12-04 397
a43cac0d9dc207 Dave Young 2015-09-09 398 /*
a43cac0d9dc207 Dave Young 2015-09-09 399 * Free up any temporary buffers allocated which are not needed
a43cac0d9dc207 Dave Young 2015-09-09 400 * after image has been loaded
a43cac0d9dc207 Dave Young 2015-09-09 401 */
a43cac0d9dc207 Dave Young 2015-09-09 402 kimage_file_post_load_cleanup(image);
a43cac0d9dc207 Dave Young 2015-09-09 403 exchange:
a43cac0d9dc207 Dave Young 2015-09-09 404 image = xchg(dest_image, image);
a43cac0d9dc207 Dave Young 2015-09-09 405 out:
9b492cf58077a0 Xunlei Pang 2016-05-23 406 if ((flags & KEXEC_FILE_ON_CRASH) && kexec_crash_image)
9b492cf58077a0 Xunlei Pang 2016-05-23 407 arch_kexec_protect_crashkres();
9b492cf58077a0 Xunlei Pang 2016-05-23 408
a43cac0d9dc207 Dave Young 2015-09-09 409 mutex_unlock(&kexec_mutex);
a43cac0d9dc207 Dave Young 2015-09-09 410 kimage_free(image);
a43cac0d9dc207 Dave Young 2015-09-09 411 return ret;
a43cac0d9dc207 Dave Young 2015-09-09 412 }
a43cac0d9dc207 Dave Young 2015-09-09 413
:::::: The code at line 320 was first introduced by commit
:::::: a43cac0d9dc2073ff2245a171429ddbe1accece7 kexec: split kexec_file syscall code to kexec_file.c
:::::: TO: Dave Young <dyoung@redhat.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-12-10 2:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 2:34 kernel test robot [this message]
2023-12-11 0:55 ` kernel/kexec_file.c:320:1: sparse: sparse: Using plain integer as NULL pointer Liu, Yujie
-- strict thread matches above, loose matches on Subject: below --
2023-02-09 8:42 kernel test robot
2022-11-12 0:07 kernel test robot
2022-10-11 15:31 kernel test robot
2022-09-06 15:56 kernel test robot
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=202312101050.6FqHvugR-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.