linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Petr Mladek <pmladek@suse.com>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 7511/7959] kernel/printk/printk_ringbuffer.h:337:21: warning: array subscript 0 is outside array bounds of 'char[0]'
Date: Fri, 29 Apr 2022 19:45:25 +0800	[thread overview]
Message-ID: <202204291904.NCK0h7cY-lkp@intel.com> (raw)

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@intel.com/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@intel.com>

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@linutronix.de>
:::::: CC: Petr Mladek <pmladek@suse.com>

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


                 reply	other threads:[~2022-04-29 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202204291904.NCK0h7cY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=pmladek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox