Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2386632lqp; Sun, 24 Mar 2024 17:08:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVEgkYYMDhSTkvbmqdGDDlxCVqa5BkdLLPm/CAPK2SXQVCuMq/SB6nxQP34DHJaloaOvnIhjltPBgGjdVqUcPSFH7jsCZ3BaOKxz+xI0w== X-Google-Smtp-Source: AGHT+IFxwanPlZnZHufejVbFwb5CuaEagn9rU16P0GfPP5blViP2rfzMO+NDbau3Kv0ettU8pnbL X-Received: by 2002:a50:d7d1:0:b0:566:41f4:a0ea with SMTP id m17-20020a50d7d1000000b0056641f4a0eamr4039356edj.37.1711325335272; Sun, 24 Mar 2024 17:08:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325335; cv=pass; d=google.com; s=arc-20160816; b=IwNs5TiX34EP0EaHOYJq/9HrcluC/2fugXDXLj3ejh9fms0XPRux/ma0am3uP0TySE KnNWuO6hgj9Yl6g2TuGypx1COm3jkmS34Lwm7NwnH7rqO+MyO9Ef7RGUyp6ly+QGhYAE e9WkI0zIaQfdjxd9tjJyEOPO9OeXFWRvKgq127OGhfyJKKvV9IIAKUmfa5ACWTwL0hSW vI8HZGSCQvrL08lSEWZi/w8XtwmJ4X1XImhDkTUvpY61VwwXcZwG5YKTJCRFG5RFif6S 5Uu5hiENvOknXhwvFN3WAAIrg6KVrIpddKrpUb0fB/8RXC3/TErFvY2uFbiwKAolJH8P CZLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xirgIhN4u202P/2w6s3mcbJUtOBSr26ljE0WVQNG6/A=; fh=jTpaaJxLHJi+pX37FBFhttUJcZqNUs5rFyYUVG4HRtc=; b=nAuEPlkBAalfLRoHtSh9GmlBvTQE78ZrFwZPJvaz2fTvt3fc+d+a7R6cx9m/OSc+Gz EFzNMnh6vuZhla8idzDc338wFo+X1/Xc4Q2Ohc4przWUGWQK15qp4d2GtvoZXM5cYYxH Jg8e3MhSVwg/ANQka1B1Cu5Up+gYuwsNu9F0REOYCeSjSJou4Fa1JB2Dg633vSUnXBgH rvlYEJcMxlMOIVcAFtOGoY7uoXrwCICHPWwa2whUEsVV/n1OoSmv9tHSrMWwRVg45HdE JvwnjoHs7MQnCiV/PcYc7YVrYiv5wVj4YG7g7dd1up+gRfa760KoQ7x1IVnkLCWrzoL2 uLkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OlO2AUgr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id es19-20020a056402381300b00568b3dddadasi1959749edb.286.2024.03.24.17.08.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:08:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OlO2AUgr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 533E41F2367A for ; Sun, 24 Mar 2024 23:57:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40E0318A72A; Sun, 24 Mar 2024 22:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OlO2AUgr" 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 4626D18A711; Sun, 24 Mar 2024 22:41:08 +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=1711320069; cv=none; b=F5Km6h2O7F8tHcAD6ouCRIOr4DFJfJnFOtgd3BUINZYM6fY1bWmmmDPRfsiFpdsWsY5ERDUJvqT+xc/munv/Fp0A4mUS5cMbW1C10dyl6hu6kxsglvioMvo9MoMcv4a6jBKY77psr27yM1YaZgXJO28lC+o6lksGKojBEgv6dVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320069; c=relaxed/simple; bh=ScdJiw+URJuyh2T7e7ak8jdhuXXwsn0SgimfE69B4C0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XPC6seWBbraAkdAp5spDg6HYEJJXvktZGKcz9IEApY95SFhmFI3CWb4zmTutVfQPJh7YeDtUUezLal8vMHcH1eoP/JxXGapHyIU7aRmXR3X0Q4gHHuwd4IPDutOzyFV1MZx/P2hcCeXhgsmDghdJ9/Dvzk4+etpMNKpOzPJr4WI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OlO2AUgr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA07CC433B1; Sun, 24 Mar 2024 22:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320068; bh=ScdJiw+URJuyh2T7e7ak8jdhuXXwsn0SgimfE69B4C0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OlO2AUgrGEg0dAeLPb799rs/MMfp8nfmij5qMYv+Gupdpko3O2TLjheSFtWLAWnIA RhvnLfa+Zmw6IOYGiQtu6QkVKiB6sL5rvfD6UlOUCWfnjk5EYlyMlnoaT08tHVlWGZ 03Hh+O7OlOC988QDIyxcpuUc4yRFOz7eh3EdKoqIl0RQc7qGHIN0FEGj7afLqjFlP6 G266tM5ryWwALpToY76QKQ/6gbP76f3KWJaYd82+dVfnoSR2jyFz775ZG8pQ3SHLJw Y3USvIqFHvtviC0IeM9JjKcC+YapAnp+yVQBPgQiNf/qRotlAWkj4CBJSt2cA8CjBV QKSEtwUNUPukA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Alex Hung , Qingqing Zhuo , Rodrigo Siqueira , Aurabindo Pillai , Alex Deucher , Harry Wentland , Sasha Levin Subject: [PATCH 6.8 378/715] drm/amd/display: Fix a potential buffer overflow in 'dp_dsc_clock_en_read()' Date: Sun, 24 Mar 2024 18:29:17 -0400 Message-ID: <20240324223455.1342824-379-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Srinivasan Shanmugam [ Upstream commit 4b09715f1504f1b6e8dff0e9643630610bc05141 ] Tell snprintf() to store at most 10 bytes in the output buffer instead of 30. Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:1508 dp_dsc_clock_en_read() error: snprintf() is printing too much 30 vs 10 Fixes: c06e09b76639 ("drm/amd/display: Add DSC parameters logging to debugfs") Cc: Alex Hung Cc: Qingqing Zhuo Cc: Rodrigo Siqueira Cc: Aurabindo Pillai Cc: Alex Deucher Signed-off-by: Srinivasan Shanmugam Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 68a8463239127..85fc6181303bb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1483,7 +1483,7 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf, const uint32_t rd_buf_size = 10; struct pipe_ctx *pipe_ctx; ssize_t result = 0; - int i, r, str_len = 30; + int i, r, str_len = 10; rd_buf = kcalloc(rd_buf_size, sizeof(char), GFP_KERNEL); -- 2.43.0