From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 0C574199385 for ; Sat, 6 Jun 2026 07:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780729737; cv=none; b=s9s0NpVGqi/mOgiCz0ZnPZEwhTt/TO3LL1UQdu0r88DWj6BwdIxF5X2DidO6YzNn/yyByXxy9DqMmknvPXLqWlgmUF+teqHkycyjrOd6KMiYcbYm4UZcXkaLRvccG0ajwV/FD/PxSmRfRNWp9wGuXUfTs/cInNjtdCBg+VGMsrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780729737; c=relaxed/simple; bh=MppUI7eDfqZQVROhWHQbERi9G52gl/0sq3OgKbNVZhA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LyGPKgQ9Sws1yJxCo+hag0dwksadZmFpVqNzQK6W/0+2YQMfk9DAjJTEFzQP+ttBFFJ/A0GpH4sdzKPMQYFsGJ6RKo4YOBiku7eWKKH+z5BUX4220DveZDvA1lGVrIAQL9PRtJHj49vHZnREuSlENH3Y+kFtTghkAaE/B2DxA+c= 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=nfr/GGoA; arc=none smtp.client-ip=209.85.128.41 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="nfr/GGoA" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-490b64c8311so29975025e9.3 for ; Sat, 06 Jun 2026 00:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780729734; x=1781334534; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oXB9BQNTN3pi9QGK7Hodfnr/DGugtVaRvxc41ybnc1o=; b=nfr/GGoA3LaTC/HqMiqG+yPXucqEC6M6S2wzRoqX7jG93QOzbdz4+o0yvuJXjb+kVr 4qrKSAbADWEf80rpnLGyLaYTKSTuNVXMiLg7gu8K5/2A3K4QKSpU6kZ2DdtEmyBDN6X6 lrllSLw5wzsaXHU9etCezId3HjxD3k6ba5scuGrGodQ0oUwEG4fm9992T7lomRJ0TTyZ ofjKIjwl78Y40/XAPhcgB/kOdjT9/tmPY91jnuZubJuXKwaLa5HFQmMJX8nrLkoj7kG4 jJADhnXztgmEfXKbjcZ7osaDsl38dvl73Kj4vm23RJxye9Kk/KFrMUfHXIMBCUkIXrJK ijgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780729734; x=1781334534; h=in-reply-to: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=oXB9BQNTN3pi9QGK7Hodfnr/DGugtVaRvxc41ybnc1o=; b=sJoXNPAnKqgSocGfa8hE0YJYxtwllYxYSU/vimcpQ7BHTdM3RQt/pEKj6g+/P3akir FkH0qgIpsccYTAzXV6xT60bvLPlPwQ0bt2SDEsQdkdIDcEklA2aLmOXpKHUe5mxkaWrj IsNa0+vQB2I8/rhnbHHn5ql7TqeX+le/yQjTse0khDDLemUIYsZnP/hj0lS0KWcySLgP jiPHSVjECPEZS00SkLMdpGVAas28k1DQ0R/Dq1yuo7Re1aHku8MmAhrCopnVMYzzrPwJ g34MfMRi+cSSndlkE1b1hIrYa3oM+Ub2GuufjCIOUnwLpmtSAQanc7q+e/BJVoyAvbpa 9ZHA== X-Forwarded-Encrypted: i=1; AFNElJ8bSDHv8NJpD9pKlqZdxaQGqkkWe4/uWO0ZG/wTnrUkjZVtZa2JkeuI+VrrEJywBTvQOlsm9XteDz+1/80=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0UqBfLrQiHtuYI70we4wJ68tnCcNtnrqHFyUs1xD4ONYQnYlP cbqv+sFnUKMz8fauPnqkk4YDcjjlxldDOtQDf0eS1WxazhO0LFC3d1Ft X-Gm-Gg: Acq92OF73VyX43NYwhpAJJ4KpoOTXIfrW6I8rYVZeTthApYMM4VXcu7GMls6s8PNzHL ZZAHJOvgqWBkcQjJ1RcO/XTynXs/41O6qQ1Js9On907fqcm4WlcOGii/5xkkIxVPW6dONCSuog/ uS/IfKDEIaRt6WrM/UPeingI5Bo+kwUHjyHb7hY56bBV2QlZyPNz7HSe6tTgke5zdiFM3lkQZUU 9EqailDmrX5h/P9hSz/BFX1IlAXNm0B3nGa/ugzeTDY7zNjnmQSxCQabclMMZUfMwD38yxSGLvU jma5CTMriYj1trWdS2FmbtR3wILa0L+MBJ56tixZFyuwwSoh5vE1EAFUBTq2ZbBfzSEZXU1YMrg ukGCnUXBIyjT/Hb/8LEl5Ndg/XnUXckMA61YZ5YipeNeQujh7rCDwcUZR74l0lL7qO07P6nETJE f3+txkS10JL03jmKPI25rY420SR+fDSg== X-Received: by 2002:a05:600c:1907:b0:490:b99c:9337 with SMTP id 5b1f17b1804b1-490c25a0800mr109044625e9.10.1780729734323; Sat, 06 Jun 2026 00:08:54 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f2dc577sm31925879f8f.3.2026.06.06.00.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2026 00:08:53 -0700 (PDT) Date: Sat, 6 Jun 2026 10:08:50 +0300 From: Dan Carpenter To: Rhys Tumelty Cc: gregkh@linuxfoundation.org, Vaibhav Agarwal , Mark Greer , Johan Hovold , Alex Elder , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: greybus: audio: fix snprintf truncation errors Message-ID: References: <20260605192857.78944-1-rhys@tumelty.co.uk> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260605192857.78944-1-rhys@tumelty.co.uk> On Fri, Jun 05, 2026 at 08:28:56PM +0100, Rhys Tumelty wrote: > change snprintf() to scnprintf() in both gbaudio_tplg_create_widget() > and gbaudio_tplg_process_kcontrols() to prevent potential string > truncation warnings when prefixing the device id to the control name. > This commit message is unclear. My understanding is that snprintf() is complaining that the array size of w->name is less than the array size of "GB %d %s" plus the array size of temp_name. This is a W=1 complaint. I hate this warning. We use snprintf() to deliberately truncate the string. Now it's complaining that the string might be truncated. Oh no! What we want to happen might happen! This is the same argument that people used to block safer alternatives to strcpy() into glibc because "it's still going to truncate the string and that's equally bad as a root exploit!" First of all, the string is not going to be truncated. (I haven't looked). Second of all, this warning makes no sense in the kernel. I have never once had a bug which I failed to debug because the last two bytes in a string were truncated. There has never been a scenario where I was looking through dmesg and snprintf() truncated some bytes so I couldn't guess what I was looking at. So your solution is to change it to scnprintf() which is kernel only and GCC doesn't know about it... I bet GCC eventually learns about scnprintf() and it eventually becomes a warning again. A better solution is to disable that annoying check. regards, dan carpenter