On Mon, Jan 22, 2024 at 04:27:05PM -0800, Kees Cook wrote: Hi Kees, ... > arch/s390/include/asm/stacktrace.h | 6 ++++-- > arch/s390/kernel/machine_kexec_file.c | 5 +++-- Subject does not match. These need to be two separate commits. > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/arch/s390/include/asm/stacktrace.h b/arch/s390/include/asm/stacktrace.h > index 31ec4f545e03..3ce08d32a8ad 100644 > --- a/arch/s390/include/asm/stacktrace.h > +++ b/arch/s390/include/asm/stacktrace.h > @@ -34,11 +34,13 @@ int get_stack_info(unsigned long sp, struct task_struct *task, > static inline bool on_stack(struct stack_info *info, > unsigned long addr, size_t len) > { > + unsigned long sum; > + > if (info->type == STACK_TYPE_UNKNOWN) > return false; > - if (addr + len < addr) > + if (check_add_overflow(addr, len, &sum)) Why not add_would_overflow()? > return false; > - return addr >= info->begin && addr + len <= info->end; > + return addr >= info->begin && sum <= info->end; > } > > /* > diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c > index 8d207b82d9fe..e5e925423061 100644 > --- a/arch/s390/kernel/machine_kexec_file.c > +++ b/arch/s390/kernel/machine_kexec_file.c > @@ -238,6 +238,7 @@ void *kexec_file_add_components(struct kimage *image, > unsigned long max_command_line_size = LEGACY_COMMAND_LINE_SIZE; > struct s390_load_data data = {0}; > unsigned long minsize; > + unsigned long sum; Please, use min_kernel_buf_len instead of sum. @Sven, could you please correct me if (minsize + max_command_line_size) means something else. > int ret; > > data.report = ipl_report_init(&ipl_block); > @@ -256,10 +257,10 @@ void *kexec_file_add_components(struct kimage *image, > if (data.parm->max_command_line_size) > max_command_line_size = data.parm->max_command_line_size; > > - if (minsize + max_command_line_size < minsize) > + if (check_add_overflow(minsize, max_command_line_size, &sum)) > goto out; > > - if (image->kernel_buf_len < minsize + max_command_line_size) > + if (image->kernel_buf_len < sum) > goto out; > > if (image->cmdline_buf_len >= max_command_line_size) Thanks!