Re: [PATCHv3 2/2] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE

From: kbuild test robot
Date: Mon Mar 02 2020 - 23:31:57 EST


Hi Dmitry,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on usb/usb-testing linus/master v5.6-rc4 next-20200302]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dmitry-Safonov/serial-sysrq-Add-MAGIC_SYSRQ_SERIAL_SEQUENCE/20200303-041809
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

New smatch warnings:
drivers/tty/serial/serial_core.c:3123 uart_try_toggle_sysrq() warn: unsigned '++port->sysrq_seq' is never less than zero.

Old smatch warnings:
drivers/tty/serial/serial_core.c:298 uart_shutdown() error: we previously assumed 'uport' could be null (see line 294)
drivers/tty/serial/serial_core.c:2741 iomem_base_show() warn: argument 4 to %lX specifier is cast from pointer

vim +3123 drivers/tty/serial/serial_core.c

3099
3100 /**
3101 * uart_try_toggle_sysrq - Enables SysRq from serial line
3102 * @port: uart_port structure where char(s) after BREAK met
3103 * @ch: new character in the sequence after received BREAK
3104 *
3105 * Enables magic SysRq when the required sequence is met on port
3106 * (see CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE).
3107 *
3108 * Returns false if @ch is out of enabling sequence and should be
3109 * handled some other way, true if @ch was consumed.
3110 */
3111 static bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)
3112 {
3113 if (ARRAY_SIZE(sysrq_toggle_seq) <= 1)
3114 return false;
3115
3116 BUILD_BUG_ON(ARRAY_SIZE(sysrq_toggle_seq) >= U8_MAX);
3117 if (sysrq_toggle_seq[port->sysrq_seq] != ch) {
3118 port->sysrq_seq = 0;
3119 return false;
3120 }
3121
3122 /* Without the last \0 */
> 3123 if (++port->sysrq_seq < (ARRAY_SIZE(sysrq_toggle_seq) - 1)) {
3124 port->sysrq = jiffies + SYSRQ_TIMEOUT;
3125 return true;
3126 }
3127
3128 schedule_work(&sysrq_enable_work);
3129
3130 port->sysrq = 0;
3131 return true;
3132 }
3133 #else
3134 static inline bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)
3135 {
3136 return false;
3137 }
3138 #endif
3139

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx