From nobody Tue Nov 26 21:40:59 2024 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 1D07F206E66; Wed, 16 Oct 2024 10:22:37 +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=1729074158; cv=none; b=MNHpc4sf+WjQCfdQ9gQpHjR6WIfLDoDDV+an4sYEww/iZlcK9DkyTdp3ZQDEH4st6WnggAs0gV2EaJh5xTRazW22XSUpUBX4LkZ1kOlPN4my2c01pTVzpouZYPLWWD6kP+to8EXDHZyBDQ3UOKF9vxlpoC7FvzmxHUJ8sbSvpCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729074158; c=relaxed/simple; bh=ZgpHQI6GK409XtLuLgOrMuqhCtgYxGC5WDTbMjcGNCQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fz/FJU+saG0DtUaVGqrf47Rpcsp0mgJUDZwZ7DiiB+cbgi/ztClPhCtSYzmP8N7bfM1AByy4cL2R+tjmX3faBmc7Z2GUFIwDs/dswkRAiOsaybfCswpUt88EK3Km3eDCDdcS5ltMjjMNsoMDdHtPdfD2/Acs4QfjI0cfm00rNec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dNp90kIq; 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="dNp90kIq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C43C4CEC5; Wed, 16 Oct 2024 10:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729074157; bh=ZgpHQI6GK409XtLuLgOrMuqhCtgYxGC5WDTbMjcGNCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dNp90kIqW6eaRwDQqDdml2VoOGQ3FJrQsvWIyRrY8m7PZR1MTTNxXOIt4IOwp6Zv6 Pv6jsrLUW5obGPukd6tm6T4yigUTXmIBDU1dghMRLAry2CYfvBCogdEm80vtKN5jRr 6AGbSbmLOhvAjD+hAkVHY5uRTEsPvzWOc+WV0s/0NLpxuLygcsnjZaC14PHJihx022 E/WrhiJal1MNMcPPYTCie/sQUIyiYvbvvO1gub2qnAGuKsAG+77abI2srR1Pm43vRy lBQOGwQjlAag0wFMkmLpPOHfQXDxdg7El4EsGByA1tw5u3t1DtzkdB/iBROwciGjxl mad3NNIHA9kzg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1t11Ap-00000004Ymh-2F9J; Wed, 16 Oct 2024 12:22:35 +0200 From: Mauro Carvalho Chehab To: Cc: Mauro Carvalho Chehab , Hans Verkuil , Martin Tuma , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 05/13] media: mgb4: protect driver against spectre Date: Wed, 16 Oct 2024 12:22:21 +0200 Message-ID: <4675c8e726c7d55bbecf9f4772370daa8b46ccd3.1729074076.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Frequency range is set from sysfs via frequency_range_store(), being vulnerable to spectre, as reported by smatch: drivers/media/pci/mgb4/mgb4_cmt.c:231 mgb4_cmt_set_vin_freq_range() warn: = potential spectre issue 'cmt_vals_in' [r] drivers/media/pci/mgb4/mgb4_cmt.c:238 mgb4_cmt_set_vin_freq_range() warn: = possible spectre second half. 'reg_set' Fix it. Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 drive= r") Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Martin T=C5=AFma --- drivers/media/pci/mgb4/mgb4_cmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/mgb4/mgb4_cmt.c b/drivers/media/pci/mgb4/mgb= 4_cmt.c index 70dc78ef193c..a25b68403bc6 100644 --- a/drivers/media/pci/mgb4/mgb4_cmt.c +++ b/drivers/media/pci/mgb4/mgb4_cmt.c @@ -227,6 +227,8 @@ void mgb4_cmt_set_vin_freq_range(struct mgb4_vin_dev *v= indev, u32 config; size_t i; =20 + freq_range =3D array_index_nospec(freq_range, ARRAY_SIZE(cmt_vals_in)); + addr =3D cmt_addrs_in[vindev->config->id]; reg_set =3D cmt_vals_in[freq_range]; =20 --=20 2.47.0