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 7BA956F2FE; Thu, 12 Dec 2024 15:42:39 +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=1734018159; cv=none; b=nJGfNQiVPCDX2QQFBen/1Oqtzn9yg+RlvejbLv+WKNvP2TFypk3JP3ZOJGKDltKi2/Pfg7yRZlWrQ+b/6M3qWz4PlmdYLtOZ48H65Bxgd2x5IouNymvwiXPYvpWtWo+xYFVByIXG8lZZcZm9o2Knlk5zkhwXbCnr/nrQTvpTKmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018159; c=relaxed/simple; bh=CFt2khe5eoD6tklhSz88rANpT8ldFBMM8QkZQl/WRow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AtnwCbGvr+b0/6oasJJ+GUmEDP4aXIv5JtvfmEviTP+K6tWqqzgWL6LFvBodCeBqXuLuW/QER+dWC2Br3Mh8BQ4oWd5PPAxqEDkJ+O18dcrL/zhKBpXDqCOKZpda51eHTDBK3utDNTFfWotmr9ygyIdw/on4zWDwser85kYZJdk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eGk7lcdX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eGk7lcdX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBD43C4CECE; Thu, 12 Dec 2024 15:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734018159; bh=CFt2khe5eoD6tklhSz88rANpT8ldFBMM8QkZQl/WRow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGk7lcdXAY1EhnyWWMjEgoCFkntlM/zBKQeNHa8YtKNHHWKwnJnrbp+PGO6tLZCoG MMUrz7VFzIzB6bF2EzwfciQZ/UJbhWXSsKjpv0fKXUkL738+vNsKe2FLelBr1Ne5eU JYNu+r6eLoqZ4BjJ6BFeahy1QNAVztSyM1VpLU2A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Igor Artemiev , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 214/356] drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check() Date: Thu, 12 Dec 2024 15:58:53 +0100 Message-ID: <20241212144253.076522503@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144244.601729511@linuxfoundation.org> References: <20241212144244.601729511@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Igor Artemiev [ Upstream commit a1e2da6a5072f8abe5b0feaa91a5bcd9dc544a04 ] It is possible, although unlikely, that an integer overflow will occur when the result of radeon_get_ib_value() is shifted to the left. Avoid it by casting one of the operands to larger data type (u64). Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Signed-off-by: Igor Artemiev Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/r600_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 1b2d31c4d77ca..ac77d1246b945 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -2104,7 +2104,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p, return -EINVAL; } - offset = radeon_get_ib_value(p, idx+1) << 8; + offset = (u64)radeon_get_ib_value(p, idx+1) << 8; if (offset != track->vgt_strmout_bo_offset[idx_value]) { DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n", offset, track->vgt_strmout_bo_offset[idx_value]); -- 2.43.0