linux-stable/arch/powerpc
Gustavo A. R. Silva af8bdab2ad crypto: p10-aes-gcm - Avoid -Wstringop-overflow warnings
[ Upstream commit aaa03fdb56 ]

The compiler doesn't know that `32` is an offset into the Hash table:

 56 struct Hash_ctx {
 57         u8 H[16];       /* subkey */
 58         u8 Htable[256]; /* Xi, Hash table(offset 32) */
 59 };

So, it legitimately complains about a potential out-of-bounds issue
if `256 bytes` are accessed in `htable` (this implies going
`32 bytes` beyond the boundaries of `Htable`):

arch/powerpc/crypto/aes-gcm-p10-glue.c: In function 'gcmp10_init':
arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: error: 'gcm_init_htable' accessing 256 bytes in a region of size 224 [-Werror=stringop-overflow=]
  120 |         gcm_init_htable(hash->Htable+32, hash->H);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 1 of type 'unsigned char[256]'
arch/powerpc/crypto/aes-gcm-p10-glue.c:120:9: note: referencing argument 2 of type 'unsigned char[16]'
arch/powerpc/crypto/aes-gcm-p10-glue.c:40:17: note: in a call to function 'gcm_init_htable'
   40 | asmlinkage void gcm_init_htable(unsigned char htable[256], unsigned char Xi[16]);
      |                 ^~~~~~~~~~~~~~~

Address this by avoiding specifying the size of `htable` in the function
prototype; and just for consistency, do the same for parameter `Xi`.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/linux-next/20231121131903.68a37932@canb.auug.org.au/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:14:16 +00:00
..
boot powerpc: dts: add missing space before { 2023-08-25 08:39:30 +10:00
configs powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2 2024-01-31 16:18:49 -08:00
crypto crypto: p10-aes-gcm - Avoid -Wstringop-overflow warnings 2024-02-05 20:14:16 +00:00
include powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping() 2024-02-05 20:14:14 +00:00
kernel powerpc: Fix build error due to is_valid_bugaddr() 2024-02-05 20:14:14 +00:00
kexec powerpc/vmcore: Add MMU information to vmcoreinfo 2023-11-20 11:59:29 +01:00
kvm KVM: PPC: Book3S HV: Handle pending exceptions on guest entry with MSR_EE 2024-01-25 15:35:13 -08:00
lib powerpc/lib: Validate size for vector operations 2024-02-05 20:14:14 +00:00
math-emu
mm powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE 2024-02-05 20:14:14 +00:00
net powerpc/bpf: populate extable entries only during the last pass 2023-05-15 15:40:31 +10:00
perf powerpc/imc-pmu: Add a null pointer check in update_events_in_group() 2024-01-25 15:35:13 -08:00
platforms powerpc/powernv: Add a null pointer check in opal_powercap_init() 2024-01-25 15:35:13 -08:00
purgatory powerpc/purgatory: remove PGO flags 2023-06-12 11:31:50 -07:00
sysdev powerpc/xive: Fix endian conversion size 2023-11-20 11:59:28 +01:00
tools powerpc/ftrace: Add support for -fpatchable-function-entry 2023-08-22 00:09:06 +10:00
xmon TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07:00
Kbuild
Kconfig powerpc/64s: Increase default stack size to 32KB 2024-01-25 15:35:42 -08:00
Kconfig.debug powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y 2023-07-03 16:07:55 +10:00
Makefile powerpc/64s: Move CPU -mtune options into Kconfig 2023-08-25 08:39:29 +10:00
Makefile.postlink kbuild: remove --include-dir MAKEFLAG from top Makefile 2023-02-05 18:51:22 +09:00