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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F960D2F7E1 for ; Fri, 5 Dec 2025 11:35:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AA4110EAD4; Fri, 5 Dec 2025 11:35:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="KbHCMCrG"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3263A10EAD4; Fri, 5 Dec 2025 11:35:07 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 4564E60138; Fri, 5 Dec 2025 11:35:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45FB8C4CEF1; Fri, 5 Dec 2025 11:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764934506; bh=RVtaNUETYVgmpQ0EhWEMCf9T407Tq7AbLmecK05zQ4Y=; h=From:To:Cc:Subject:Date:From; b=KbHCMCrGUE79SkrgwHCEMOkeNJzhA6hJUJj5AjI35JETrIe9WYmM/70/93uhzbvxO LvflnnG18QjoInD1bKtPObFu1lFexVCewDpsDzl1CXD4uEogdwhTxnL2a+qw/R9Yl5 ooltVR08iMCw4p7KF2bchUcPr5PiS9XKbh1WDlIoqfo2j9v+xP2ttwKn04eV0OI1ez JpEvhgfZbvHbwbbl0SnMdRDzEnavW4kf6H95IfZJ4XY0NTgX1DElc+DF1fgy8EA8et HpXbE61scMeMSH9ONlwsw+San61+xnx6y6zohhJT2ECA9vm8dCL6zviH46M5qoT5gc KoZsvfn0sPb4w== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/i915: Fix format string truncation warning Date: Fri, 5 Dec 2025 12:35:01 +0100 Message-ID: <20251205113500.684286-2-ardb@kernel.org> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2289; i=ardb@kernel.org; h=from:subject; bh=RVtaNUETYVgmpQ0EhWEMCf9T407Tq7AbLmecK05zQ4Y=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIdPocGr+aetlnRqrZitPf1p10fuC4EWfc4vOCOqeETuY1 Lmg8uDVjlIWBjEuBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjCRF2oM/8MNqvM8myP+p3A4 pAev3hH5+8GO+uuLvgVw3ThzMiF+4TFGhr+fbUWe3y0Mk3A/IiSWtXfDbut1Ggpr16y29Vzso/L yFzsA X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: 8bit X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" GCC notices that the 16-byte uabi_name field could theoretically be too small for the formatted string if the instance number exceeds 100. So grow the field to 20 bytes. drivers/gpu/drm/i915/intel_memory_region.c: In function ‘intel_memory_region_create’: drivers/gpu/drm/i915/intel_memory_region.c:273:61: error: ‘%u’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 3 and 11 [-Werror=format-truncation=] 273 | snprintf(mem->uabi_name, sizeof(mem->uabi_name), "%s%u", | ^~ drivers/gpu/drm/i915/intel_memory_region.c:273:58: note: directive argument in the range [0, 65535] 273 | snprintf(mem->uabi_name, sizeof(mem->uabi_name), "%s%u", | ^~~~~~ drivers/gpu/drm/i915/intel_memory_region.c:273:9: note: ‘snprintf’ output between 7 and 19 bytes into a destination of size 16 273 | snprintf(mem->uabi_name, sizeof(mem->uabi_name), "%s%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | intel_memory_type_str(type), instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ard Biesheuvel --- v2: grow buffer instead of changing the output Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Cc: David Airlie Cc: Simona Vetter Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org drivers/gpu/drm/i915/intel_memory_region.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_memory_region.h b/drivers/gpu/drm/i915/intel_memory_region.h index b3b75be9ced5..e9a4e6090fe0 100644 --- a/drivers/gpu/drm/i915/intel_memory_region.h +++ b/drivers/gpu/drm/i915/intel_memory_region.h @@ -72,7 +72,7 @@ struct intel_memory_region { u16 instance; enum intel_region_id id; char name[16]; - char uabi_name[16]; + char uabi_name[20]; bool private; /* not for userspace */ struct { -- 2.47.3