arch/alpha/kernel/err_tsunami.c:653:22-23: WARNING opportunity for min()
kernel test robot
build botBCC: [email protected]
CC: [email protected]
TO: Magnus Lindholm <[email protected]>
CC: Matt Turner <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha.git for-linus head: 71cf9644bcb35e686c3e12a703325335a0925946 commit: 71cf9644bcb35e686c3e12a703325335a0925946 [57/57] alpha: add bounded Clipper console-log scanning
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: alpha-randconfig-r2105-20261020 (https://download.01.org/0day-ci/archive/20261020/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 12.5.0
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
| Reported-by: kernel test robot <[email protected]> | Reported-by: Julia Lawall <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
cocci warnings: (new ones prefixed by >>)
>> arch/alpha/kernel/err_tsunami.c:653:22-23: WARNING opportunity for min()
vim +653 arch/alpha/kernel/err_tsunami.c
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 647
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 648 static void __init
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 649 tsunami_console_data_log(int cpu, struct percpu_struct *pcpu)
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 650 {
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 651 unsigned char *data = (void *)(IDENT_ADDR | pcpu->console_data_log_pa);
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 652 size_t length = pcpu->console_data_log_length;
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 @653 size_t dump = length < 1024 ? length : 1024;
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 654
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 655 printk("%sConsole data log for CPU %d (%zu bytes):\n",
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 656 err_print_prefix, cpu, length);
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 657 if (!(pcpu->console_data_log_pa & 7) &&
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 658 length <= ~0UL - (unsigned long)data &&
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 659 tsunami_console_log(data, length)) {
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 660 /* Acknowledge only after reaching a valid termination packet. */
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 661 pcpu->console_data_log_pa = 0;
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 662 return;
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 663 }
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 664 printk("%s Incomplete console log; retaining firmware pointer\n",
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 665 err_print_prefix);
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 666 /* Byte reads preserve partial headers without rounding beyond length. */
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 667 if (dump > ~0UL - (unsigned long)data)
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 668 return;
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 669 print_hex_dump(err_print_prefix, " ", DUMP_PREFIX_OFFSET, 16, 1,
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 670 data, dump, false);
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 671 if (dump < length)
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 672 printk("%s Raw console log truncated to %zu bytes\n",
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 673 err_print_prefix, dump);
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 674 }
71cf9644bcb35e6 Magnus Lindholm 2026-10-14 675 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki