[linux-next:master 7511/7959] kernel/printk/printk_ringbuffer.h:337:21: warning: array subscript 0 is outside array bounds of 'char[0]'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5469f0c06732a077c70a759a81f2a1f00b277694
commit: 5c8df7795d6f44449192cf311174aec77b60c49f [7511/7959] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
config: s390-randconfig-r003-20220428 (https://download.01.org/0day-ci/archive/20220429/202204291904.NCK0h7cY-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5c8df7795d6f44449192cf311174aec77b60c49f
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 5c8df7795d6f44449192cf311174aec77b60c49f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash kernel/

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

All warnings (new ones prefixed by >>):

   In file included from kernel/printk/printk.c:58:
   kernel/printk/printk.c: In function '__console_emit_next_record.constprop':
>> kernel/printk/printk_ringbuffer.h:337:21: warning: array subscript 0 is outside array bounds of 'char[0]' [-Warray-bounds]
     337 |         r->text_buf = text_buf;
         |         ~~~~~~~~~~~~^~~~~~~~~~
   kernel/printk/printk.c:2980:21: note: while referencing 'text'
    2980 |         static char text[CONSOLE_LOG_MAX];
         |                     ^~~~


vim +337 kernel/printk/printk_ringbuffer.h

b6cf8b3f3312e2f John Ogness 2020-07-09  319  
b6cf8b3f3312e2f John Ogness 2020-07-09  320  /**
b6cf8b3f3312e2f John Ogness 2020-07-09  321   * prb_rec_init_rd() - Initialize a buffer for reading records.
b6cf8b3f3312e2f John Ogness 2020-07-09  322   *
b6cf8b3f3312e2f John Ogness 2020-07-09  323   * @r:             The record to initialize.
b6cf8b3f3312e2f John Ogness 2020-07-09  324   * @info:          A buffer to store record meta-data.
b6cf8b3f3312e2f John Ogness 2020-07-09  325   * @text_buf:      A buffer to store text data.
b6cf8b3f3312e2f John Ogness 2020-07-09  326   * @text_buf_size: The size of @text_buf.
b6cf8b3f3312e2f John Ogness 2020-07-09  327   *
b6cf8b3f3312e2f John Ogness 2020-07-09  328   * Initialize all the fields that a reader is interested in. All arguments
b6cf8b3f3312e2f John Ogness 2020-07-09  329   * (except @r) are optional. Only record data for arguments that are
b6cf8b3f3312e2f John Ogness 2020-07-09  330   * non-NULL or non-zero will be read.
b6cf8b3f3312e2f John Ogness 2020-07-09  331   */
b6cf8b3f3312e2f John Ogness 2020-07-09  332  static inline void prb_rec_init_rd(struct printk_record *r,
b6cf8b3f3312e2f John Ogness 2020-07-09  333  				   struct printk_info *info,
f35efc78add6439 John Ogness 2020-09-19  334  				   char *text_buf, unsigned int text_buf_size)
b6cf8b3f3312e2f John Ogness 2020-07-09  335  {
b6cf8b3f3312e2f John Ogness 2020-07-09  336  	r->info = info;
b6cf8b3f3312e2f John Ogness 2020-07-09 @337  	r->text_buf = text_buf;
b6cf8b3f3312e2f John Ogness 2020-07-09  338  	r->text_buf_size = text_buf_size;
b6cf8b3f3312e2f John Ogness 2020-07-09  339  }
b6cf8b3f3312e2f John Ogness 2020-07-09  340  

:::::: The code at line 337 was first introduced by commit
:::::: b6cf8b3f3312e2ffe38f23c7c692eb9389277a9a printk: add lockless ringbuffer

:::::: TO: John Ogness <john.ogness@xxxxxxxxxxxxx>
:::::: CC: Petr Mladek <pmladek@xxxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[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