Re: [linux-next:master 5670/6619] kernel/printk/printk.c:2871:24: warning: array subscript 0 is outside array bounds of 'char[0]'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-09-20, kernel test robot <lkp@xxxxxxxxx> wrote:
>    kernel/printk/printk.c: In function 'console_flush_all':
>>> kernel/printk/printk.c:2871:24: warning: array subscript 0 is outside array bounds of 'char[0]' [-Warray-bounds]
>     2871 |         char *outbuf = &printk_shared_pbufs.outbuf[0];
>          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It is crazy all the things that get compiled in !CONFIG_PRINTK. We
definitely need to fix that after this rework.

As for this warning, anyone have anything against something like:

#ifdef CONFIG_PRINTK
static bool console_emit_next_record(struct console *con, bool *handover, int cookie)
{
   ... implementation ...
}
#else
static bool console_emit_next_record(struct console *con, bool *handover, int cookie)
{
        *handover = false;
        return false;
}
#endif

John




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux