From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6408C421A0A for ; Fri, 22 May 2026 14:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779460504; cv=none; b=hmzBBNeWqRarn7ei8J4rZgzWcwYGj2d5SBUdl2PntEM8yQhHSoAYCvEbFHHSAvWFpPiC9lRuRvA6h47O7ZS+hT7+/EFa+k61B9MpEiY2JeVYhzn6gZy2Qg61DSAltl/M8swBEZlGFTb3nbIYbfy0tfEO87Uic/ram6AlSHC3y/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779460504; c=relaxed/simple; bh=1ssrb7J/bifTr1tstxSO54qch/dy5aqP71wuKx2S9jI=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=canmYJj3/EWmuL0Q8S2+qmLjTEdLd3OtsI1RzMNikIYqE/WX+rUZVnY5f46jxFrNYwAZLbGm6vMkfZIiU0RGBclmFrztmiHk5snPSgGgHFnVL6oBOgAKr7Boor/W4zGdkx6W3/qi9lWQE6ygswtvAUDDIZTg+S6eIuqQoZrQyAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UEjec+Jb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UEjec+Jb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AB251F0155A; Fri, 22 May 2026 14:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779460502; bh=7JPgi0/Koq+xrbSftk7/iF8qG0o+Jq3QebqgcvvRJXk=; h=Date:From:To:Cc:Subject:References; b=UEjec+JbfZqNvb2qXRkQJOwkc/vebPno5lOCvtSiZnk2H7opCpsvz3mc4VBuNvFUS /o2M64/m8CVRldyDbgg5ALHrYSxOd/2mCpeZ+iNizfmflKvxOpv0Vh02ohfCC8oZoY n5+91xKMaEzZ16KlfqirXrSJ641NUkxNMa7npBHTtUpFcwa5Fp7JRVM/njIgLqvRCI ayCJ7K2O5jg06nHZhwMmYn/S/z8cottJ+SG6/0LfBh0wHSv2+yctWnwyYtwl/FdS7R sertPJ5dq4TAkGT1NbiGqmKSsdP3PHUWR9s4OsyDuUZrEXXncfosDptDhr1Awjgo3Y 0NLd7uXHJeW3A== Received: from rostedt by gandalf with local (Exim 4.99.2) (envelope-from ) id 1wQQyD-00000006687-3gK8; Fri, 22 May 2026 10:35:25 -0400 Message-ID: <20260522143525.736370754@kernel.org> User-Agent: quilt/0.69 Date: Fri, 22 May 2026 10:35:13 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , David Laight , Qian-Yu Lin Subject: [for-next][PATCH 05/15] tracing: Remove local variable for argument detection from trace_printk() References: <20260522143508.298439732@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Qian-Yu Lin The trace_printk() macro uses a local variable _______STR to detect whether variadic arguments are present. This name can shadow outer variables. Replace the local variable with sizeof applied directly to the stringified arguments: if (sizeof __stringify((__VA_ARGS__)) > 3) This eliminates the shadowing risk entirely without introducing any additional includes or local variables. Verified with objdump on samples/trace_printk that all four cases branch correctly: __trace_bputs, __trace_puts, __trace_bprintk, and __trace_printk. Link: https://patch.msgid.link/20260502075535.34997-1-tiffany019230@gmail.com Suggested-by: David Laight Signed-off-by: Qian-Yu Lin Signed-off-by: Steven Rostedt --- include/linux/trace_printk.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/trace_printk.h b/include/linux/trace_printk.h index 2670ec7f4262..3d54f440dccf 100644 --- a/include/linux/trace_printk.h +++ b/include/linux/trace_printk.h @@ -86,8 +86,7 @@ do { \ #define trace_printk(fmt, ...) \ do { \ - char _______STR[] = __stringify((__VA_ARGS__)); \ - if (sizeof(_______STR) > 3) \ + if (sizeof __stringify((__VA_ARGS__)) > 3) \ do_trace_printk(fmt, ##__VA_ARGS__); \ else \ trace_puts(fmt); \ -- 2.53.0