Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp385748pxb; Wed, 3 Mar 2021 05:55:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNi599S2BQUmvfWEkDzfIq3BHtqLAP/2btHUu1249BTKJDTBmowrdINefT26bQH9V/92GO X-Received: by 2002:a17:906:bd2:: with SMTP id y18mr5597315ejg.482.1614779741832; Wed, 03 Mar 2021 05:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614779741; cv=none; d=google.com; s=arc-20160816; b=vgaz3FzTHrx76RYA7gXvF3nWSsT+fuGK3D8pxo4MHCcDoH/c7CEL2l2HhQ+L4RhQpW 8D5g/ZFweX7Kr4eKXDV8azPY85qBHrbNC0yBG03Q6vpDJARejVcmnhzU280mvP3GQ6Yb LGKkjpIVKotezhlI1FKmY+BI+KHsS/5E/sSRiMEUamS5tS+MAszIo6L8Y83wT5LJuCrO G9iFz8+rdhZ7A9wOcJyxNZP8tB2Y2USRAYrT/jjLMqL6ol2Tl4u7rCSTewzSNAzJzwn7 OS/SA00M3dsnm+tKjAK8KF4ZjCs+9LNb09CorrsPtXqJHhimC7PJqeNcN/hfXTex+kE4 5wYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tc2NQbdNwSTu1PSRAmA5rk7D8KKT78t/+GdYhYqArjg=; b=LSx3yXKl3rS9uykKfIo4J+O5cD+FcGuppnv4ASZ5xKbq5PsQKjbMMond+hQBvTMJqh Wq5eoHVOeN6PuYZvC8fDA+h4nsd0OkQ9i4OoVw5wcRhUCc45DJCmOEzKTmTGcwJbm+HP 2mtDB/FTZRsf7YTCfTObO8GGfsaxaU4SWNAnfQoHsahc8lLXht7m9lvscu9LikwZXYVh i/cpQlMyuoRztLdHeVLgnUxNCNevqfrOwdt1A3GcevDcSXpJt94OBA2C9quxt2SqtYm5 NP7jeny4likwISLJlvhUV6Y2Pl0fSIs/jX/JxUJaXusd+/yI3TySDbDlZa3NLlKzhL2B Wxew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MF5RQKMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si15733013edm.154.2021.03.03.05.55.10; Wed, 03 Mar 2021 05:55:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MF5RQKMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243032AbhCAUNd (ORCPT + 99 others); Mon, 1 Mar 2021 15:13:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:33278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236542AbhCARDs (ORCPT ); Mon, 1 Mar 2021 12:03:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BFC164F57; Mon, 1 Mar 2021 16:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616744; bh=mnDo72+ePxEKb50JijZpx/O4nzijQnw2sOxbbWuVGbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MF5RQKMzsqgn80n0pVeJcd9baqLwAv8X03pH4kpMx8MW/13zo80l5AQn8RZDQSF4y /44Dfqbz91zRWvtvBB0wHJcpWGBajPQNfQC75legvUYhW+WoEOyn5zEtXJ6RviZSWi Kr/kyxG5iyQkeNOt8PlUiH7Jq7VwO9iS2LXznqHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacopo Mondi , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 080/247] media: i2c: ov5670: Fix PIXEL_RATE minimum value Date: Mon, 1 Mar 2021 17:11:40 +0100 Message-Id: <20210301161035.602663841@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacopo Mondi [ Upstream commit dc1eb7c9c290cba52937c9a224b22a400bb0ffd7 ] The driver currently reports a single supported value for V4L2_CID_PIXEL_RATE and initializes the control's minimum value to 0, which is very risky, as userspace might accidentally use it as divider when calculating the time duration of a line. Fix this by using as minimum the only supported value when registering the control. Fixes: 5de35c9b8dcd1 ("media: i2c: Add Omnivision OV5670 5M sensor support") Signed-off-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov5670.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 53dd30d96e691..62dfdcb6e0bd6 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2081,7 +2081,8 @@ static int ov5670_init_controls(struct ov5670 *ov5670) /* By default, V4L2_CID_PIXEL_RATE is read only */ ov5670->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, - V4L2_CID_PIXEL_RATE, 0, + V4L2_CID_PIXEL_RATE, + link_freq_configs[0].pixel_rate, link_freq_configs[0].pixel_rate, 1, link_freq_configs[0].pixel_rate); -- 2.27.0