From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F8B0CE79AC for ; Wed, 20 Sep 2023 09:41:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33DCE6B011C; Wed, 20 Sep 2023 05:41:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2ED616B0130; Wed, 20 Sep 2023 05:41:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DC786B013B; Wed, 20 Sep 2023 05:41:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0EF0F6B011C for ; Wed, 20 Sep 2023 05:41:58 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C17C0A100F for ; Wed, 20 Sep 2023 09:41:57 +0000 (UTC) X-FDA: 81256484274.29.00156AE Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by imf20.hostedemail.com (Postfix) with ESMTP id C11A11C0030 for ; Wed, 20 Sep 2023 09:41:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=C9eLkgVh; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf20.hostedemail.com: domain of lkp@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695202915; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=cEonIXDDi3Kid0Nx8rLvd3xQwz+/JL+L/oZMiLlGMqk=; b=haJIvBzBLaZ7qlpyN9s1/bbQxo80FBHH0dkYBl7yvgr06ElYdypdYsppqYV5/SMXZu9yOo pbnTtKY3rFd1hzYHN2CAFLE1PtAIIohEAwSpPlX1ViN1D+zUtJj/9lmD3xeU36Hvb+YhR7 oGYw5TJXl+lgP6lwj2/YnLwcErWL1YY= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=C9eLkgVh; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf20.hostedemail.com: domain of lkp@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695202915; a=rsa-sha256; cv=none; b=wbT/gp3XglhCa8n8MWpI7u0HIhF7KOjWFrJdCz6JJawUCWoX32wT8b+Hu7c8xSVshRcwZW e++AlfgkxgwsLqNLi2TpKsVkc3RwIIFrSPgRKpf7LgjqVB9TEJh/S83oPp+rAEk5CiGXwq YOY1aYx89Hf8TsyIYaXrFjNtf+PEjpw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695202914; x=1726738914; h=date:from:to:cc:subject:message-id:mime-version; bh=4tGzmPR5HHySkb9CyhTat+Y4RJcoM4MrfxezC5+g3xM=; b=C9eLkgVhKMY5P1oQ1qSTxAIDhcWXWMFBlXzh/U/xp4YgXBFtu06e8433 /mUD8wI1BYpuvJsYLmFQjEt9e4L+b0SZaFK/w6SDTBMl97v7SAtIrtWGr wK9ji5uOH0osBauZHTZfAcg0ES9qgv3sEcYJC5dVXpMKiRctpcGtNG/xo Aig/uNh9AR9+Yoh9rgr7XKumt4p0kNW3V+LFNBbqLWEH+cFmXKGMyVPcf xgYUO7AHZW5gqBEUeAUgRemH33xNj5pOWBb/ftaAzDnIZtFfUxzxbAzpk PD4NnUXuo2Z/VFiPyp6yglHav1XJRlm6AfVCY6ENgmSdpSYm0CuOiMa1a w==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="411118957" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="411118957" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 02:41:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="775925061" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="775925061" Received: from lkp-server02.sh.intel.com (HELO 9ef86b2655e5) ([10.239.97.151]) by orsmga008.jf.intel.com with ESMTP; 20 Sep 2023 02:41:51 -0700 Received: from kbuild by 9ef86b2655e5 with local (Exim 4.96) (envelope-from ) id 1qitiP-0008as-0M; Wed, 20 Sep 2023 09:41:49 +0000 Date: Wed, 20 Sep 2023 17:40:53 +0800 From: kernel test robot To: Thomas Gleixner Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Petr Mladek , John Ogness Subject: [linux-next:master 5670/6619] kernel/printk/printk.c:2871:24: warning: array subscript 0 is outside array bounds of 'char[0]' Message-ID: <202309201724.M9BMAQIh-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: C11A11C0030 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 9tq7dn1zk8fsfq6bb6e3ngb7a3qtpcph X-HE-Tag: 1695202914-431474 X-HE-Meta: U2FsdGVkX1+eNn7tbPnByNM57Xrk/IMDfLJaNl8sTkY6Cyyyub7ucYbNeYeMd89AM5dkoamCJ/P8v8SburqFU/3Zvf6C4GrT+pURAlptNCouJkVi/boIMKvhAov2bAXyu8/JGaCc+vgOmM0ZMiIBLP/0J+OPQi4oWBBdkrNPTomTlEnRtpCLUdRpq/NPFdu11/BJ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/1yImmh4E7WEhTUTjosoTbjeeaNMS7hClNgxlJlKwa6yI1ler0wwvTZ+MmwtavFNABjKDi9KcD/psbhQrB4rl0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 926f75c8a5ab70567eb4c2d82fbc96963313e564 commit: 06653d57ff283be627a2c769139d73ecc487810f [5670/6619] printk: nbcon: Add emit function and callback function for atomic printing config: s390-randconfig-r004-20230825 (https://download.01.org/0day-ci/archive/20230920/202309201724.M9BMAQIh-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309201724.M9BMAQIh-lkp@intel.com/reproduce) 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 | Closes: https://lore.kernel.org/oe-kbuild-all/202309201724.M9BMAQIh-lkp@intel.com/ All warnings (new ones prefixed by >>): 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]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from kernel/printk/printk.c:61: kernel/printk/internal.h:112:17: note: while referencing 'outbuf' 112 | char outbuf[PRINTK_MESSAGE_MAX]; | ^~~~~~ kernel/printk/printk.c:2851:23: note: defined here 'printk_shared_pbufs' 2851 | struct printk_buffers printk_shared_pbufs; | ^~~~~~~~~~~~~~~~~~~ vim +2871 kernel/printk/printk.c d818b56f77521e kernel/printk/printk.c John Ogness 2023-09-16 2852 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2853 /* 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2854 * Print one record for the given console. The record printed is whatever 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2855 * record is the next available record for the given console. 03a749e628fdbc kernel/printk/printk.c John Ogness 2022-04-21 2856 * a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2857 * @handover will be set to true if a printk waiter has taken over the fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2858 * console_lock, in which case the caller is no longer holding both the fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2859 * console_lock and the SRCU read lock. Otherwise it is set to false. fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2860 * fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2861 * @cookie is the cookie from the SRCU read lock. ^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2862 * a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2863 * Returns false if the given console has no next record to print, otherwise a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2864 * true. ^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2865 * fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2866 * Requires the console_lock and the SRCU read lock. ^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2867 */ 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2868 static bool console_emit_next_record(struct console *con, bool *handover, int cookie) ^1da177e4c3f41 kernel/printk.c Linus Torvalds 2005-04-16 2869 { 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2870 bool is_extended = console_srcu_read_flags(con) & CON_EXTENDED; d818b56f77521e kernel/printk/printk.c John Ogness 2023-09-16 @2871 char *outbuf = &printk_shared_pbufs.outbuf[0]; 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2872 struct printk_message pmsg = { d818b56f77521e kernel/printk/printk.c John Ogness 2023-09-16 2873 .pbufs = &printk_shared_pbufs, 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2874 }; 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2875 unsigned long flags; 896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2876 a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2877 *handover = false; 78944e549d3667 kernel/printk.c Antonino A. Daplas 2006-08-05 2878 ea308da1198f8c kernel/printk/printk.c John Ogness 2023-01-09 2879 if (!printk_get_next_message(&pmsg, con->seq, is_extended, true)) a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2880 return false; 7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2881 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2882 con->dropped += pmsg.dropped; 896fbe20b4e233 kernel/printk/printk.c John Ogness 2020-07-09 2883 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2884 /* Skip messages of formatted length 0. */ 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2885 if (pmsg.outbuf_len == 0) { 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2886 con->seq = pmsg.seq + 1; 084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2887 goto skip; 084681d14e429c kernel/printk.c Kay Sievers 2012-06-28 2888 } 649e6ee33f73ba kernel/printk.c Kay Sievers 2012-05-10 2889 c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2890 if (con->dropped && !is_extended) { c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2891 console_prepend_dropped(&pmsg, con->dropped); c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2892 con->dropped = 0; 6fe29354befe4c kernel/printk/printk.c Tejun Heo 2015-06-25 2893 } 7ff9554bb578ba kernel/printk.c Kay Sievers 2012-05-03 2894 dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2895) /* dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2896) * While actively printing out messages, if another printk() dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2897) * were to occur on another CPU, it may wait for this one to dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2898) * finish. This task can not be preempted if there is a dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2899) * waiter waiting to take over. 93d102f094be9b kernel/printk/printk.c John Ogness 2021-07-15 2900 * 93d102f094be9b kernel/printk/printk.c John Ogness 2021-07-15 2901 * Interrupts are disabled because the hand over to a waiter 93d102f094be9b kernel/printk/printk.c John Ogness 2021-07-15 2902 * must not be interrupted until the hand over is completed 93d102f094be9b kernel/printk/printk.c John Ogness 2021-07-15 2903 * (@console_waiter is cleared). dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2904) */ 93d102f094be9b kernel/printk/printk.c John Ogness 2021-07-15 2905 printk_safe_enter_irqsave(flags); c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2906 console_lock_spinning_enable(); dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2907) c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2908 /* Do not trace print latency. */ c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2909 stop_critical_timings(); c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2910 c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2911 /* Write everything out to the hardware. */ c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2912 con->write(con, outbuf, pmsg.outbuf_len); c4fcc617e14879 kernel/printk/printk.c John Ogness 2023-01-09 2913 2d9ef940f89e0a kernel/printk/printk.c Petr Mladek 2022-06-23 2914 start_critical_timings(); dbdda842fe96f8 kernel/printk/printk.c Steven Rostedt (VMware 2018-01-10 2915) 2830eec14afd18 kernel/printk/printk.c John Ogness 2023-01-09 2916 con->seq = pmsg.seq + 1; a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2917 fc956ae0de7fa2 kernel/printk/printk.c John Ogness 2022-11-16 2918 *handover = console_lock_spinning_disable_and_check(cookie); c162d5b4338d72 kernel/printk/printk.c Petr Mladek 2018-01-12 2919 printk_safe_exit_irqrestore(flags); a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2920 skip: a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2921 return true; a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2922 } a699449bb13b70 kernel/printk/printk.c John Ogness 2022-04-21 2923 :::::: The code at line 2871 was first introduced by commit :::::: d818b56f77521ecc5e3eda71dc9b2beb3d6681e3 printk: Make static printk buffers available to nbcon :::::: TO: John Ogness :::::: CC: Petr Mladek -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki