From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5046B2C0299 for ; Fri, 5 Dec 2025 11:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764934506; cv=none; b=X2M1ETucu/vCr389YZTkqAs2pP9Crf4G153ouM+xU7T7VpfxRQ0BzCMC9WwF6O1+ufAofQ/RcXQ7scSEouoFlunbg8uZOjUHwZ+FwamcSTlvpA7FykbMlcwzws4NTuRWFzudyilcpuqp3429VZkCyhe3GpRxBrCSKWtcot/AjB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764934506; c=relaxed/simple; bh=RVtaNUETYVgmpQ0EhWEMCf9T407Tq7AbLmecK05zQ4Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MxifGCp+D62cmmNLcHYzagoLipiCceNP6XMQePDAZh7sJVUoa2Of42vSFQwiFFvCOc28SuUbuBTuK44mJJfOIQaQrR09v6uFtwPrR6dxZrdbqkWITVDyYZ3okrTsKYN9YqmyOvOg7J3IzJsqDn0VYxMBfIU8S5GDd9k6U7zqsYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KbHCMCrG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KbHCMCrG" 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 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 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 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