All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>,
	jason.wessel@windriver.com, danielt@kernel.org,
	dianders@chromium.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	kgdb-bugreport@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kdb: use sizeof(kdb_prompt_str) instead of mismatched CMD_BUFLEN
Date: Wed, 17 Jun 2026 18:43:54 +0800	[thread overview]
Message-ID: <202606171818.9AqxpkQ1-lkp@intel.com> (raw)
In-Reply-To: <uqjlxgcu6y6ukayda7jka7ji73ctkj4f3632rejud6cqqayfwx@kuyf2f2lvett>

Hi Naveen,

kernel test robot noticed the following build errors:

[auto build test ERROR on v7.1]
[also build test ERROR on linus/master next-20260616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Naveen-Kumar-Chaudhary/kdb-use-sizeof-kdb_prompt_str-instead-of-mismatched-CMD_BUFLEN/20260617-055312
base:   v7.1
patch link:    https://lore.kernel.org/r/uqjlxgcu6y6ukayda7jka7ji73ctkj4f3632rejud6cqqayfwx%40kuyf2f2lvett
patch subject: [PATCH] kdb: use sizeof(kdb_prompt_str) instead of mismatched CMD_BUFLEN
config: hexagon-randconfig-001-20260617 (https://download.01.org/0day-ci/archive/20260617/202606171818.9AqxpkQ1-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260617/202606171818.9AqxpkQ1-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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606171818.9AqxpkQ1-lkp@intel.com/

All errors (new ones prefixed by >>):

>> kernel/debug/kdb/kdb_main.c:1268:34: error: invalid application of 'sizeof' to an incomplete type 'char[]'
    1268 |                 snprintf(kdb_prompt_str, sizeof(kdb_prompt_str),
         |                                                ^~~~~~~~~~~~~~~~
   1 error generated.


vim +1268 kernel/debug/kdb/kdb_main.c

  1124	
  1125	/*
  1126	 * kdb_local - The main code for kdb.  This routine is invoked on a
  1127	 *	specific processor, it is not global.  The main kdb() routine
  1128	 *	ensures that only one processor at a time is in this routine.
  1129	 *	This code is called with the real reason code on the first
  1130	 *	entry to a kdb session, thereafter it is called with reason
  1131	 *	SWITCH, even if the user goes back to the original cpu.
  1132	 * Inputs:
  1133	 *	reason		The reason KDB was invoked
  1134	 *	error		The hardware-defined error code
  1135	 *	regs		The exception frame at time of fault/breakpoint.
  1136	 *	db_result	Result code from the break or debug point.
  1137	 * Returns:
  1138	 *	0	KDB was invoked for an event which it wasn't responsible
  1139	 *	1	KDB handled the event for which it was invoked.
  1140	 *	KDB_CMD_GO	User typed 'go'.
  1141	 *	KDB_CMD_CPU	User switched to another cpu.
  1142	 *	KDB_CMD_SS	Single step.
  1143	 */
  1144	static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
  1145			     kdb_dbtrap_t db_result)
  1146	{
  1147		char *cmdbuf;
  1148		int diag;
  1149		struct task_struct *kdb_current =
  1150			curr_task(raw_smp_processor_id());
  1151	
  1152		KDB_DEBUG_STATE("kdb_local 1", reason);
  1153	
  1154		kdb_check_for_lockdown();
  1155	
  1156		kdb_go_count = 0;
  1157		if (reason == KDB_REASON_DEBUG) {
  1158			/* special case below */
  1159		} else {
  1160			kdb_printf("\nEntering kdb (current=0x%px, pid %d) ",
  1161				   kdb_current, kdb_current ? kdb_current->pid : 0);
  1162	#if defined(CONFIG_SMP)
  1163			kdb_printf("on processor %d ", raw_smp_processor_id());
  1164	#endif
  1165		}
  1166	
  1167		switch (reason) {
  1168		case KDB_REASON_DEBUG:
  1169		{
  1170			/*
  1171			 * If re-entering kdb after a single step
  1172			 * command, don't print the message.
  1173			 */
  1174			switch (db_result) {
  1175			case KDB_DB_BPT:
  1176				kdb_printf("\nEntering kdb (0x%px, pid %d) ",
  1177					   kdb_current, kdb_current->pid);
  1178	#if defined(CONFIG_SMP)
  1179				kdb_printf("on processor %d ", raw_smp_processor_id());
  1180	#endif
  1181				kdb_printf("due to Debug @ " kdb_machreg_fmt "\n",
  1182					   instruction_pointer(regs));
  1183				break;
  1184			case KDB_DB_SS:
  1185				break;
  1186			case KDB_DB_SSBPT:
  1187				KDB_DEBUG_STATE("kdb_local 4", reason);
  1188				return 1;	/* kdba_db_trap did the work */
  1189			default:
  1190				kdb_printf("kdb: Bad result from kdba_db_trap: %d\n",
  1191					   db_result);
  1192				break;
  1193			}
  1194	
  1195		}
  1196			break;
  1197		case KDB_REASON_ENTER:
  1198			if (KDB_STATE(KEYBOARD))
  1199				kdb_printf("due to Keyboard Entry\n");
  1200			else
  1201				kdb_printf("due to KDB_ENTER()\n");
  1202			break;
  1203		case KDB_REASON_KEYBOARD:
  1204			KDB_STATE_SET(KEYBOARD);
  1205			kdb_printf("due to Keyboard Entry\n");
  1206			break;
  1207		case KDB_REASON_ENTER_SLAVE:
  1208			/* drop through, slaves only get released via cpu switch */
  1209		case KDB_REASON_SWITCH:
  1210			kdb_printf("due to cpu switch\n");
  1211			break;
  1212		case KDB_REASON_OOPS:
  1213			kdb_printf("Oops: %s\n", kdb_diemsg);
  1214			kdb_printf("due to oops @ " kdb_machreg_fmt "\n",
  1215				   instruction_pointer(regs));
  1216			kdb_dumpregs(regs);
  1217			break;
  1218		case KDB_REASON_SYSTEM_NMI:
  1219			kdb_printf("due to System NonMaskable Interrupt\n");
  1220			break;
  1221		case KDB_REASON_NMI:
  1222			kdb_printf("due to NonMaskable Interrupt @ "
  1223				   kdb_machreg_fmt "\n",
  1224				   instruction_pointer(regs));
  1225			break;
  1226		case KDB_REASON_SSTEP:
  1227		case KDB_REASON_BREAK:
  1228			kdb_printf("due to %s @ " kdb_machreg_fmt "\n",
  1229				   reason == KDB_REASON_BREAK ?
  1230				   "Breakpoint" : "SS trap", instruction_pointer(regs));
  1231			/*
  1232			 * Determine if this breakpoint is one that we
  1233			 * are interested in.
  1234			 */
  1235			if (db_result != KDB_DB_BPT) {
  1236				kdb_printf("kdb: error return from kdba_bp_trap: %d\n",
  1237					   db_result);
  1238				KDB_DEBUG_STATE("kdb_local 6", reason);
  1239				return 0;	/* Not for us, dismiss it */
  1240			}
  1241			break;
  1242		case KDB_REASON_RECURSE:
  1243			kdb_printf("due to Recursion @ " kdb_machreg_fmt "\n",
  1244				   instruction_pointer(regs));
  1245			break;
  1246		default:
  1247			kdb_printf("kdb: unexpected reason code: %d\n", reason);
  1248			KDB_DEBUG_STATE("kdb_local 8", reason);
  1249			return 0;	/* Not for us, dismiss it */
  1250		}
  1251	
  1252		while (1) {
  1253			/*
  1254			 * Initialize pager context.
  1255			 */
  1256			kdb_nextline = 1;
  1257			KDB_STATE_CLEAR(SUPPRESS);
  1258			kdb_grepping_flag = 0;
  1259			/* ensure the old search does not leak into '/' commands */
  1260			kdb_grep_string[0] = '\0';
  1261	
  1262			cmdbuf = cmd_cur;
  1263			*cmdbuf = '\0';
  1264			*(cmd_hist[cmd_head]) = '\0';
  1265	
  1266	do_full_getstr:
  1267			/* PROMPT can only be set if we have MEM_READ permission. */
> 1268			snprintf(kdb_prompt_str, sizeof(kdb_prompt_str),
  1269				 kdbgetenv("PROMPT"), raw_smp_processor_id());
  1270	
  1271			/*
  1272			 * Fetch command from keyboard
  1273			 */
  1274			cmdbuf = kdb_getstr(cmdbuf, CMD_BUFLEN, kdb_prompt_str);
  1275			if (*cmdbuf != '\n') {
  1276				if (*cmdbuf < 32) {
  1277					if (cmdptr == cmd_head) {
  1278						strscpy(cmd_hist[cmd_head], cmd_cur,
  1279							CMD_BUFLEN);
  1280						*(cmd_hist[cmd_head] +
  1281						  strlen(cmd_hist[cmd_head])-1) = '\0';
  1282					}
  1283					if (!handle_ctrl_cmd(cmdbuf))
  1284						*(cmd_cur+strlen(cmd_cur)-1) = '\0';
  1285					cmdbuf = cmd_cur;
  1286					goto do_full_getstr;
  1287				} else {
  1288					strscpy(cmd_hist[cmd_head], cmd_cur,
  1289						CMD_BUFLEN);
  1290				}
  1291	
  1292				cmd_head = (cmd_head+1) % KDB_CMD_HISTORY_COUNT;
  1293				if (cmd_head == cmd_tail)
  1294					cmd_tail = (cmd_tail+1) % KDB_CMD_HISTORY_COUNT;
  1295			}
  1296	
  1297			cmdptr = cmd_head;
  1298			diag = kdb_parse(cmdbuf);
  1299			if (diag == KDB_NOTFOUND) {
  1300				drop_newline(cmdbuf);
  1301				kdb_printf("Unknown kdb command: '%s'\n", cmdbuf);
  1302				diag = 0;
  1303			}
  1304			if (diag == KDB_CMD_GO
  1305			 || diag == KDB_CMD_CPU
  1306			 || diag == KDB_CMD_SS
  1307			 || diag == KDB_CMD_KGDB)
  1308				break;
  1309	
  1310			if (diag)
  1311				kdb_cmderror(diag);
  1312		}
  1313		KDB_DEBUG_STATE("kdb_local 9", diag);
  1314		return diag;
  1315	}
  1316	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2026-06-17 10:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 16:44 [PATCH] kdb: use sizeof(kdb_prompt_str) instead of mismatched CMD_BUFLEN Naveen Kumar Chaudhary
2026-06-16 20:20 ` David Laight
2026-06-16 22:06   ` Doug Anderson
2026-06-16 22:04 ` Doug Anderson
2026-06-17  2:28   ` [PATCH v2] kdb: unify CMD_BUFLEN definition into kdb_private.h Naveen Kumar Chaudhary
2026-06-17  3:00     ` Naveen Kumar Chaudhary
2026-06-17 21:16     ` Doug Anderson
2026-06-17 10:43 ` kernel test robot [this message]
2026-06-17 19:49 ` [PATCH] kdb: use sizeof(kdb_prompt_str) instead of mismatched CMD_BUFLEN kernel test robot

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=202606171818.9AqxpkQ1-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=danielt@kernel.org \
    --cc=dianders@chromium.org \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=naveen.osdev@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.