Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2579317lqp; Mon, 25 Mar 2024 03:22:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3vQqzQmVroI06ukuOVPZXJrrCUo/RG/deF9rJZkdpgEyMtQD/zSZrw/M2Qt+wWJ49x09A3m/1aampbc0RzEateCYP1wEaclTUQFgivg== X-Google-Smtp-Source: AGHT+IGHT0VxMlZ1+Tch4Jp8K6lWyx0UXLpbbOYal/ySexF/RvVTPQB8GbraEy2BXKDsAXjUP/Og X-Received: by 2002:a0c:e58e:0:b0:696:7b3c:7799 with SMTP id t14-20020a0ce58e000000b006967b3c7799mr5466184qvm.7.1711362120693; Mon, 25 Mar 2024 03:22:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711362120; cv=pass; d=google.com; s=arc-20160816; b=K2iE66CdniIBGdPDq/n+U5XmeNOZLYprAAZpKibD3er66lYmMf0ZwX2ijdM6ctK3qe R98kL7grE81YMjFx2HKNBXF5aWIx0bvGofUKNwhFZMFc66dCPwt+Ti7KQY+6NIOLRmIq HH5eGRIWrCxA5kEQ28EnwQ04C3fLh1zYV6M/qqBDyBWLxzmU3mH/0Dzn/Uc3+ZR7TiGE ww7dRgvjpBx96hyxU0fZhyPcJ9Pr7zFZaZrHY5LQf0jPbzGvMmKP+2+LPwG99M1xAHer xd1c3yM1pU0p8u3TkT/EcM7U0y3LV3vhyhVjGFYzPXlOXlbm3oErMR/+7t6j7LA3Y8jr WQlw== 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=J2GTcunKX+z8ETHOjNAJM/BsAfleVvPLwxTCpk11+6w=; fh=jTpaaJxLHJi+pX37FBFhttUJcZqNUs5rFyYUVG4HRtc=; b=q+iP+ONEOtL5OZ1hk2cQVLt07Po8hhD6h1Llq2yse/aliP2q0iwYI1qAHG3KotXF56 kvYVyE7qEWek0zYKVm49ggMZRlD5JFmDmb0B5BlGVrJDjfmDOtt+gy3WB1kZtH3fIiyI aEibc1sEEAnp3+AV1ZZx7qex0zmzp6pbCWFas8UKi8OJiZcrZoxfgYN5O8No9BP5QoKZ I/CDUmhKDkM3hyYS20bQMY97CBi3wa4r/u75gcWKFdKOqEg94srxrE2oEgrpeyldHjOh sYmtKNnTtAfbBQWymlIf7mP+xozJUlPuK7OWEx+RMAlbR5PBJh121/QLqZvNcYJI5Q6L Xnwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CurqQ5Pd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u5-20020a0562141c0500b00690047b8128si7228021qvc.190.2024.03.25.03.22.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:22:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CurqQ5Pd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116175-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 647D91C30506 for ; Mon, 25 Mar 2024 10:22:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9A663B7175; Mon, 25 Mar 2024 03:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CurqQ5Pd" 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 17A5C17BB18; Sun, 24 Mar 2024 23:42:33 +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=1711323754; cv=none; b=gC0mbQVPWEJ6XImW2+hVBftxkVDSlkOj62uY+nZOL2MEQGGtGoteEDVUUD5COd9CvSFkcu36/HLMsM2fadEzKle7o0hNbhsK/N+gvXWUTmvX8yxlZ1Am5fHbwrn4jXYIn5/LvM42q7KQz3GiHYHpfbG2rYjSxYPe5B1OWVX/LUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323754; c=relaxed/simple; bh=dfcRdPeTUVayWJRGEkGDb9i9+Ny8gRfj+JhkWtSCsHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LUiCfcACHV9Fsxrj2FTaAZcW5a/Bf0IQXIOBCzLFsqEufhJB/xxVbmGzHrSZlhv/4vxQlQp3k3GYcTC3SX9Z/4i4vPscsDWAaIZrUPkmAXGzShrkpI6ZpQFJ/6kcztjwUmCkZ37RnDGtBSSBjoJxmjNcPwjy3XJbbdwF4UsJp+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CurqQ5Pd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89C32C43394; Sun, 24 Mar 2024 23:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323753; bh=dfcRdPeTUVayWJRGEkGDb9i9+Ny8gRfj+JhkWtSCsHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CurqQ5PdV6Y8vVDCoXVTmsBQCOztTtJ29Nqw4ptDo+CGda6wzBpePDBy5P9sHAy8q GiuvuysI3aIbQ9/oFCXF78eFaqtd9iDScnnhKwhbphPFFfV+a0peMs8K0Mot2w60Na c+H1dh63361JEr9Qgw46BSJnUtTIJS2c6wtcfzDDXFEb4esSDxL8vBPyNihRuqfNp2 yO7gmxXsRktmrYIz/sJ3TgQsawhfa+u/kimyxvQedujChDzyAEfxHF4CcgNgoS72z0 xMaRxf+8R5JIodVoWvhXp8DCRvi+/fcfHKWBuGHj2+irMhbrm+K6kCwnwN5hW0p7Dl IDhQMDFjfPbXQ== 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 5.10 128/238] drm/amd/display: Fix a potential buffer overflow in 'dp_dsc_clock_en_read()' Date: Sun, 24 Mar 2024 19:38:36 -0400 Message-ID: <20240324234027.1354210-129-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 e43f82bcb231a..32dbd2a270887 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 @@ -1179,7 +1179,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