linux-mainline/arch/s390/kernel
Peter Oberparleiter 5c95bf2746 s390/cert_store: fix string length handling
Building cert_store.o with W=1 reveals this bug:

        CC      arch/s390/kernel/cert_store.o
          arch/s390/kernel/cert_store.c:443:45: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
            443 |         sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);
                |                                             ^
          arch/s390/kernel/cert_store.c:443:9: note: ‘sprintf’ output between 15 and 18 bytes into a destination of size 15
            443 |         sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);

Fix this by using the correct maximum width for each integer component
in both buffer length calculation and format string. Also switch to
using snprintf() to guard against potential future changes to the
integer range of each component.

Fixes: 8cf57d7217 ("s390: add support for user-defined certificates")
Reported-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2023-09-19 13:25:44 +02:00
..
syscalls arch: Register fchmodat2, usually as syscall 452 2023-07-27 12:25:35 +02:00
vdso32 s390/vdso: filter out mno-pic-data-is-text-relative cflag 2023-06-28 13:57:10 +02:00
vdso64 s390/vdso: filter out mno-pic-data-is-text-relative cflag 2023-06-28 13:57:10 +02:00
.gitignore
abs_lowcore.c
alternative.c
asm-offsets.c s390/tracing: pass struct ftrace_regs to ftrace_trace_function 2023-07-24 12:12:24 +02:00
audit.c audit: add support for the openat2 syscall 2021-10-01 16:52:48 -04:00
audit.h
cache.c
cert_store.c s390/cert_store: fix string length handling 2023-09-19 13:25:44 +02:00
compat_audit.c
compat_linux.c
compat_linux.h
compat_ptrace.h
compat_signal.c
cpcmd.c s390: include linux/io.h instead of asm/io.h 2023-07-03 11:19:40 +02:00
cpufeature.c
crash_dump.c s390/crash: use the correct type for memory allocation 2023-06-20 19:52:12 +02:00
debug.c
diag.c s390/diag: fix diagnose 8c description 2023-07-27 13:11:35 +02:00
dis.c s390: fix various typos 2023-07-03 11:19:42 +02:00
dumpstack.c
early_printk.c
early.c s390/mm: simplify kernel mapping setup 2023-08-30 11:03:27 +02:00
earlypgm.S s390/earlypgm: use SYM* macros instead of ENTRY(), etc. 2023-04-19 17:24:17 +02:00
ebcdic.c s390/ebcdic: fix typo in comment 2023-07-27 13:11:35 +02:00
entry.h init: consolidate prototypes in linux/init.h 2023-06-09 17:44:16 -07:00
entry.S s390: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-09 15:20:50 +02:00
fpu.c
ftrace.c
ftrace.h
guarded_storage.c
head64.S s390: consistently use .balign instead of .align 2023-06-28 13:57:09 +02:00
idle.c
ima_arch.c
ipl_vmparm.c
ipl.c s390/ipl: refactor deprecated strncpy 2023-08-18 15:08:12 +02:00
irq.c
jump_label.c
kdebugfs.c
kexec_elf.c
kexec_image.c
kprobes_insn_page.S s390: consistently use .balign instead of .align 2023-06-28 13:57:09 +02:00
kprobes.c
kprobes.h
lgr.c
machine_kexec_file.c s390/ipl: fix virtual vs physical address confusion 2023-08-18 15:08:12 +02:00
machine_kexec_reloc.c
machine_kexec.c s390/amode31: change type of __samode31, __eamode31, etc 2023-08-30 11:03:27 +02:00
Makefile s390/kexec: make machine_kexec() depend on CONFIG_KEXEC_CORE 2023-07-24 12:12:23 +02:00
mcount.S s390: remove unneeded #include <asm/export.h> 2023-08-09 15:20:50 +02:00
module.c s390/module: fix rela calculation for R_390_GOTENT 2023-06-20 19:55:00 +02:00
nmi.c
nospec-branch.c s390: fix various typos 2023-07-03 11:19:42 +02:00
nospec-sysfs.c
numa.c
os_info.c
perf_cpum_cf_events.c
perf_cpum_cf.c s390/cpum_cf: remove unneeded debug statements 2023-07-04 07:45:17 +02:00
perf_cpum_sf.c s390/cpum_sf: remove check on CPU being online 2023-07-04 07:45:18 +02:00
perf_event.c
perf_pai_crypto.c s390/pai_crypto: replace atomic_t with refcount_t 2023-05-15 14:12:14 +02:00
perf_pai_ext.c s390: fix various typos 2023-07-03 11:19:42 +02:00
perf_regs.c
process.c s390: include linux/io.h instead of asm/io.h 2023-07-03 11:19:40 +02:00
processor.c
ptrace.c
reipl.S s390/reipl: use SYM* macros instead of ENTRY(), etc. 2023-04-19 17:24:17 +02:00
relocate_kernel.S s390/relocate_kernel: adjust indentation 2023-04-19 17:24:18 +02:00
rethook.c
rethook.h
runtime_instr.c
setup.c s390/amode31: change type of __samode31, __eamode31, etc 2023-08-30 11:03:27 +02:00
signal.c
smp.c s390/smp: ensure global control register contents are in sync 2023-08-09 15:20:50 +02:00
stacktrace.c
sthyi.c s390 updates for 6.6 merge window 2023-08-28 17:22:39 -07:00
syscall.c
sysinfo.c
text_amode31.S s390/amode31: use SYM* macros instead of ENTRY(), etc. 2023-04-19 17:24:16 +02:00
time.c s390: fix various typos 2023-07-03 11:19:42 +02:00
topology.c s390/topology: honour nr_cpu_ids when adding CPUs 2023-05-15 14:20:14 +02:00
trace.c
traps.c
unwind_bc.c
uprobes.c
uv.c s390/uv: UV feature check utility 2023-08-28 09:27:55 +00:00
vdso.c
vmlinux.lds.S
vtime.c