From: kernel test robot <lkp@intel.com>
To: Ian Rogers <irogers@google.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@kernel.org>
Subject: include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 0
Date: Tue, 07 Apr 2026 12:03:11 +0800 [thread overview]
Message-ID: <202604070917.ZVd6Ugz4-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bfe62a454542cfad3379f6ef5680b125f41e20f4
commit: a339671db64b12bb02492557d2b0658811286277 vdso: Switch get/put_unaligned() from packed struct to memcpy()
date: 3 months ago
config: mips-randconfig-r111-20260406 (https://download.01.org/0day-ci/archive/20260407/202604070917.ZVd6Ugz4-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 13.4.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260407/202604070917.ZVd6Ugz4-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
| Fixes: a339671db64b ("vdso: Switch get/put_unaligned() from packed struct to memcpy()")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604070917.ZVd6Ugz4-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/byteorder/little_endian.h:5,
from arch/mips/include/uapi/asm/byteorder.h:15,
from arch/mips/include/asm/bitops.h:21,
from include/linux/bitops.h:67,
from include/linux/kernel.h:23,
from arch/mips/boot/compressed/decompress.c:14:
In function 'get_unaligned_le32',
inlined from 'decompress_kernel' at arch/mips/boot/compressed/decompress.c:113:16:
>> include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 0 [-Wstringop-overread]
23 | __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 | sizeof(__get_unaligned_val)); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
include/linux/unaligned.h:23:28: note: in expansion of macro '__get_unaligned_t'
23 | return le32_to_cpu(__get_unaligned_t(__le32, p));
| ^~~~~~~~~~~~~~~~~
In file included from arch/mips/boot/compressed/decompress.c:22:
arch/mips/boot/compressed/decompress.h: In function 'decompress_kernel':
arch/mips/boot/compressed/decompress.h:6:39: note: at offset -4 into source object '__image_end' of size [0, 2147483647]
6 | extern unsigned char __image_begin[], __image_end[];
| ^~~~~~~~~~~
vim +/__builtin_memcpy +23 include/vdso/unaligned.h
6
7 /**
8 * __get_unaligned_t - read an unaligned value from memory.
9 * @type: the type to load from the pointer.
10 * @ptr: the pointer to load from.
11 *
12 * Use memcpy to affect an unaligned type sized load avoiding undefined behavior
13 * from approaches like type punning that require -fno-strict-aliasing in order
14 * to be correct. As type may be const, use __unqual_scalar_typeof to map to a
15 * non-const type - you can't memcpy into a const type. The
16 * __get_unaligned_ctrl_type gives __unqual_scalar_typeof its required
17 * expression rather than type, a pointer is used to avoid warnings about mixing
18 * the use of 0 and NULL. The void* cast silences ubsan warnings.
19 */
20 #define __get_unaligned_t(type, ptr) ({ \
21 type *__get_unaligned_ctrl_type __always_unused = NULL; \
22 __unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \
> 23 __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
24 sizeof(__get_unaligned_val)); \
25 __get_unaligned_val; \
26 })
27
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-04-07 4:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 4:03 kernel test robot [this message]
2026-04-07 5:12 ` Ian Rogers
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=202604070917.ZVd6Ugz4-lkp@intel.com \
--to=lkp@intel.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=tglx@kernel.org \
/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
all inboxes | Powered by JetHome®