linux/include
Guenter Roeck 5c4e0a21fa string: uninline memcpy_and_pad
When building m68k:allmodconfig, recent versions of gcc generate the
following error if the length of UTS_RELEASE is less than 8 bytes.

  In function 'memcpy_and_pad',
    inlined from 'nvmet_execute_disc_identify' at
      drivers/nvme/target/discovery.c:268:2: arch/m68k/include/asm/string.h:72:25: error:
	'__builtin_memcpy' reading 8 bytes from a region of size 7

Discussions around the problem suggest that this only happens if an
architecture does not provide strlen(), if -ffreestanding is provided as
compiler option, and if CONFIG_FORTIFY_SOURCE=n. All of this is the case
for m68k. The exact reasons are unknown, but seem to be related to the
ability of the compiler to evaluate the return value of strlen() and
the resulting execution flow in memcpy_and_pad(). It would be possible
to work around the problem by using sizeof(UTS_RELEASE) instead of
strlen(UTS_RELEASE), but that would only postpone the problem until the
function is called in a similar way. Uninline memcpy_and_pad() instead
to solve the problem for good.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-11-03 11:41:25 -07:00
..
acpi ACPI updates for 5.16-rc1 2021-11-02 15:58:39 -07:00
asm-generic hyperv-next for 5.16 2021-11-02 10:56:49 -07:00
clocksource ARM: 2021-11-02 11:24:14 -07:00
crypto crypto: ecc - Export additional helper functions 2021-10-29 21:04:03 +08:00
drm drm: Update MST First Link Slot Information Based on Encoding Format 2021-10-25 21:21:07 -04:00
dt-bindings ASoC: dt-bindings: rename q6afe.h to q6dsp-lpass-ports.h 2021-10-26 13:49:57 +01:00
keys
kunit
kvm
linux string: uninline memcpy_and_pad 2021-11-03 11:41:25 -07:00
math-emu
media
memory
misc
net Revert "net: avoid double accounting for pure zerocopy skbs" 2021-11-01 22:26:08 -07:00
pcmcia
ras
rdma RDMA/hns: Use the core code to manage the fixed mmap entries 2021-10-29 14:07:31 -03:00
scsi overflow updates for v5.16-rc1 2021-11-01 17:12:56 -07:00
soc Core: 2021-11-02 06:20:58 -07:00
sound ASoC: Updates for v5.16 2021-11-01 16:58:27 +01:00
target
trace Core: 2021-11-02 06:20:58 -07:00
uapi RDMA v5.16 merge window pull request 2021-11-03 08:05:59 -07:00
vdso
video
xen