From: kernel test robot <lkp@intel.com>
To: David Disseldorp <ddiss@suse.de>,
linux-kbuild@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, linux-next@vger.kernel.org,
ddiss@suse.de, nsc@kernel.org
Subject: Re: [PATCH v3 8/8] initramfs_test: add filename padding test case
Date: Wed, 20 Aug 2025 04:16:48 +0800 [thread overview]
Message-ID: <202508200304.wF1u78il-lkp@intel.com> (raw)
In-Reply-To: <20250819032607.28727-9-ddiss@suse.de>
Hi David,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.17-rc2 next-20250819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/David-Disseldorp/gen_init_cpio-write-to-fd-instead-of-stdout-stream/20250819-115406
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20250819032607.28727-9-ddiss%40suse.de
patch subject: [PATCH v3 8/8] initramfs_test: add filename padding test case
config: sparc64-randconfig-r121-20250819 (https://download.01.org/0day-ci/archive/20250820/202508200304.wF1u78il-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f)
reproduce: (https://download.01.org/0day-ci/archive/20250820/202508200304.wF1u78il-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/oe-kbuild-all/202508200304.wF1u78il-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> init/initramfs_test.c:415:18: sparse: sparse: Initializer entry defined twice
init/initramfs_test.c:425:18: sparse: also defined here
vim +415 init/initramfs_test.c
388
389 /*
390 * An initramfs filename is namesize in length, including the zero-terminator.
391 * A filename can be zero-terminated prior to namesize, with the remainder used
392 * as padding. This can be useful for e.g. alignment of file data segments with
393 * a 4KB filesystem block, allowing for extent sharing (reflinks) between cpio
394 * source and destination. This hack works with both GNU cpio and initramfs, as
395 * long as PATH_MAX isn't exceeded.
396 */
397 static void __init initramfs_test_fname_pad(struct kunit *test)
398 {
399 char *err;
400 size_t len;
401 struct file *file;
402 char fdata[] = "this file data is aligned at 4K in the archive";
403 struct test_fname_pad {
404 char padded_fname[4096 - CPIO_HDRLEN];
405 char cpio_srcbuf[CPIO_HDRLEN + PATH_MAX + 3 + sizeof(fdata)];
406 } *tbufs = kzalloc(sizeof(struct test_fname_pad), GFP_KERNEL);
407 struct initramfs_test_cpio c[] = { {
408 .magic = "070701",
409 .ino = 1,
410 .mode = S_IFREG | 0777,
411 .uid = 0,
412 .gid = 0,
413 .nlink = 1,
414 .mtime = 1,
> 415 .filesize = 0,
416 .devmajor = 0,
417 .devminor = 1,
418 .rdevmajor = 0,
419 .rdevminor = 0,
420 /* align file data at 4K archive offset via padded fname */
421 .namesize = 4096 - CPIO_HDRLEN,
422 .csum = 0,
423 .fname = tbufs->padded_fname,
424 .data = fdata,
425 .filesize = sizeof(fdata),
426 } };
427
428 memcpy(tbufs->padded_fname, "padded_fname", sizeof("padded_fname"));
429 len = fill_cpio(c, ARRAY_SIZE(c), tbufs->cpio_srcbuf);
430
431 err = unpack_to_rootfs(tbufs->cpio_srcbuf, len);
432 KUNIT_EXPECT_NULL(test, err);
433
434 file = filp_open(c[0].fname, O_RDONLY, 0);
435 if (IS_ERR(file)) {
436 KUNIT_FAIL(test, "open failed");
437 goto out;
438 }
439
440 /* read back file contents into @cpio_srcbuf and confirm match */
441 len = kernel_read(file, tbufs->cpio_srcbuf, c[0].filesize, NULL);
442 KUNIT_EXPECT_EQ(test, len, c[0].filesize);
443 KUNIT_EXPECT_MEMEQ(test, tbufs->cpio_srcbuf, c[0].data, len);
444
445 fput(file);
446 KUNIT_EXPECT_EQ(test, init_unlink(c[0].fname), 0);
447 out:
448 kfree(tbufs);
449 }
450
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-08-19 20:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 3:05 [PATCH v3 0/8] gen_init_cpio: add copy_file_range / reflink support David Disseldorp
2025-08-19 3:05 ` [PATCH v3 1/8] gen_init_cpio: write to fd instead of stdout stream David Disseldorp
2025-08-19 3:05 ` [PATCH v3 2/8] gen_init_cpio: support -o <output_file> parameter David Disseldorp
2025-08-19 3:05 ` [PATCH v3 3/8] gen_init_cpio: attempt copy_file_range for file data David Disseldorp
2025-08-19 3:05 ` [PATCH v3 4/8] gen_init_cpio: avoid duplicate strlen calls David Disseldorp
2025-08-19 3:05 ` [PATCH v3 5/8] gen_initramfs.sh: use gen_init_cpio -o parameter David Disseldorp
2025-08-19 3:05 ` [PATCH v3 6/8] docs: initramfs: file data alignment via name padding David Disseldorp
2025-08-19 3:05 ` [PATCH v3 7/8] gen_init_cpio: add -a <data_align> as reflink optimization David Disseldorp
2025-08-19 3:05 ` [PATCH v3 8/8] initramfs_test: add filename padding test case David Disseldorp
2025-08-19 20:16 ` kernel test robot [this message]
2025-08-20 1:13 ` David Disseldorp
2025-08-20 21:02 ` Nicolas Schier
2025-08-21 5:04 ` David Disseldorp
2025-08-21 5:40 ` Nicolas Schier
2025-08-21 19:09 ` [PATCH v3 0/8] gen_init_cpio: add copy_file_range / reflink support Nathan Chancellor
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=202508200304.wF1u78il-lkp@intel.com \
--to=lkp@intel.com \
--cc=ddiss@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=nsc@kernel.org \
--cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox