From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81F2E30F7F3 for ; Mon, 4 May 2026 08:20:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777882828; cv=none; b=Oe6T995o1PPLu2FCJyVwq2KiVBE49WTXlxy1aNnghneoiG/tF5fNfHwIzEsg/+JALhV5VXZfx2JaPir/G9iHzMhvAAoKa0EFQMB1HDVmZD2PYhRhcq+OmaZu9893HkEqV7dfs8FMqqWOc1gcdQH0eesokbI3stQmVpXkzvrXyK0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777882828; c=relaxed/simple; bh=+mydfnL4vM5StXG/f2s8um8Nr1MmmzkqBvge19552RE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YguNId5k/gQA8zVvvOByBYPKZs1vtNLuPykF8JhKRvBtUu/1nf+mXJa248LQeoPOWfL6xJcwnn0NHSZF3enYD1W3GZLUmF3B6cftjaalDR/55hOdOCl6bwqRP+R7/x4oYJTF4Hqef5bUtcDDzZyRWEe2psYoJjJpXRgNqMxwqvk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ehg8q3eA; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ehg8q3eA" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-48374014a77so43041105e9.3 for ; Mon, 04 May 2026 01:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777882825; x=1778487625; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=1qXHrao/DQSVUQ/JdyrdgWknBXPVBjBYFrToqrQ25ag=; b=Ehg8q3eAWUVFUGdlkYZ5ykmztXRAKDQiJM7956uIbBwSbzfTxJEEUHg35ia83u84Wc fneoEOHm0pOhIyW30Y0DnKg5SXwDlRKQyy+G4Hgnp35AQJg2A0YI5Pt9CiqtiVuvNpnG Sh7X2qst7Biu4ijRW6r8/lXZsBsluGUBhAqtrcoiAEQv7wx/NKkUt14orCFWnrb4wYdO LPuA4pg8047JrgedaFG15ex716vTS3aKek4nkzDnpZdtp90c/c52uxBDDxEq7F197lTJ MhnI1g8uIblgcUX+p/V2PpJCEFj/lQKtxQFcMe7q5TfKt6F0iQw36g4Nv6hC7QS9YLaf O1Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777882825; x=1778487625; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1qXHrao/DQSVUQ/JdyrdgWknBXPVBjBYFrToqrQ25ag=; b=UvINasXYfWEhVfqw5zmDFR+7WeYnN5QhGtEv/9sVCz0jW4UU7M7zJrHpygmm5UQMA1 USvuLXNwl2Q8z5ZItYoqDkCit1QZBZfWDzvxKyv1gT7iqHbAYC5lui5jfADZqFwq30dZ XoHFv1gxwL4nTAWtP0A7Ncq6Iiv20vomtKOAbuDSaXLc4dwtYj5E6NsOIlNQ6rnp2q0n w3Z+uA4LBaJosYY7sR4D1byPbck5esX3kmCsP3UQOyR4EbFyv/78KUfWjlPs09K0XDJy 6+ZQQJ+3ZZvqHjNzuvo6x9D30+PDQQYhDRkhy5o1ZgbuziBQMBtf9m6Cibtny017WPp0 w6xQ== X-Gm-Message-State: AOJu0Yxx2hRkJfQVxR+8c1LzTYSEmL5lcFvQhWIm1e+bfyxEmN+ed5fM mOpXEF1+LHTnKznayzXEeBrEIQSbepdPCEm7GAfUx5RbS6SfVSsr9hLx X-Gm-Gg: AeBDies3H46VKMHtLrq/E5pTMy/Gomg3vTnbnl/JlN/SksMAuvJTb2tpQiK3ffc6iwI qnOfwJ1X6HHdJdkprTA9Bh/WEBTSB2O6FkqhpnqHkhtOfJzeA9G4e43fPDJvQVXUbZgJ+dHL2S6 uwXkQOBxmWhQaj87/4sXcGd1nLmIk5k4RKWscgpUUjGJYv+sEX8pwi84mxQbBGJzylV44+a49Oy NTBjVG3ViULXScO4FPd+83532+zAQVAp4Pxv0LjSBXs0XX1izncqQiWh5ufkw7GjJTr/fajM2j/ kvfDTQlYhIPmhdBHJpgExe6cxXPU8hN2s1RiTc4EtwYSzsusHit4OzoICMXDd9n/NAMxpnV0+8Q /pAXUBkZ9mq/dytGTCtDjFKrcqW+Dny9+8ouhj4E2+GcbeROyOpGROkqEPPHrmaLs8AgahNwX2G kT1+sX13vweAIN6oy++LLrzHylb6zQ1A== X-Received: by 2002:a05:600c:c089:b0:489:e126:b757 with SMTP id 5b1f17b1804b1-48a98676a31mr116716115e9.25.1777882824539; Mon, 04 May 2026 01:20:24 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8fe92924sm73569525e9.2.2026.05.04.01.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2026 01:20:23 -0700 (PDT) Date: Mon, 4 May 2026 11:20:20 +0300 From: Dan Carpenter To: Harshit Mogalapalli Cc: smatch@vger.kernel.org Subject: Re: Build problem smatch 1.75 Message-ID: References: Precedence: bulk X-Mailing-List: smatch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, May 04, 2026 at 01:25:43PM +0530, Harshit Mogalapalli wrote: > Hi Dan, > > Build error: > > pre-process.c: In function ‘parse_expansion’: > pre-process.c:1648:16: error: variable-sized object may not be initialized > 1648 | struct arg_state args[slots] = {}; > | ^~~~~~~~~ What compiler are you using? This is a bug in Sparse. We should probably fix it there. Apparently you can't use variable length arrays with an initializer. Why do C compilers have to suck? They should have made an exception for memset to zero. > pre-process.c: In function ‘find_include’: > pre-process.c:1015:56: warning: ‘%s’ directive output may be truncated > writing up to 255 bytes into a region of size between 1 and 4096 > [-Wformat-truncation=] > 1015 | snprintf(buf, sizeof(buf), "%s/%s", cwd, > entry->d_name); > | ^~ > pre-process.c:1015:25: note: ‘snprintf’ output between 2 and 4352 bytes into > a destination of size 4097 > 1015 | snprintf(buf, sizeof(buf), "%s/%s", cwd, > entry->d_name); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > I think the problem is introduced by: > > Fixes: 1a9a98e3c7b8 ("__VA_OPT__: parsing") > > I think we need a memset() in parse_expansion() The snprintf() warnings are my fault but I hate that warning. I don't care if the snprintf() truncates... Truncating is the whole reason that I use it... Anyway, sure let me silence that. regards, dan carpenter >From bcc58b9ccf06d28ab6be4f0992bc74f462aa12f8 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 4 May 2026 11:16:24 +0300 Subject: [PATCH] pre-process: silence a -Wformat-truncation warning Add a check for snprintf() overflows to make GCC happy. Signed-off-by: Dan Carpenter --- pre-process.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pre-process.c b/pre-process.c index d9a0a9e73a73..fdcc29338c94 100644 --- a/pre-process.c +++ b/pre-process.c @@ -1012,7 +1012,11 @@ const char *find_include(const char *skip, const char *look_for) lstat(entry->d_name, &statbuf); if (strcmp(entry->d_name, look_for) == 0) { - snprintf(buf, sizeof(buf), "%s/%s", cwd, entry->d_name); + int cnt; + + cnt = snprintf(buf, sizeof(buf), "%s/%s", cwd, entry->d_name); + if (cnt >= sizeof(buf)) + return NULL; closedir(dp); return buf; } -- 2.53.0