Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3963069pxb; Tue, 2 Mar 2021 03:13:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCGx9ZqdSAsEc+H+1/JVprRAwJwYRg4DtmgXyCqryoExSAkmSa+bgo1Lyv5uTrh5J4Laca X-Received: by 2002:a17:906:789:: with SMTP id l9mr19828347ejc.161.1614683602881; Tue, 02 Mar 2021 03:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614683602; cv=none; d=google.com; s=arc-20160816; b=zJLSZ0ddevqKAub1w1Cddh1133sBiBcq0LKiU7G1VdrldFucz95mdK4gUZqyqjISHz aMfRXTG7Nyzpt1fz57MyJkFJ/ZzBeQ/wNLPV3IPpNkKXtUgbdE5OgP3YHb2+pfynMano KHRi8p5qCJkXeiFmLcrJ49Iz4oiXvYTC///2aBzUYPYOpIDY7iArLxCD0r7sPUt+VVle O7qNt+XqvHWyPppMGCdQiimFwo7WR4wRofOD5mgqtIShnhLqtneRXNo9Py8ANfDkzeRF KZmB6yWZk+LQPrTTSFR4yy7VbTnIJKr3cSbCD0+RAUfZVl9VJwrzeDEYUI5NV/6Yn1ty zrEQ== 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=VAjqjQ0oTgnQXCyJY0sVl4ZG1mSUnSQmP/WfLgFQ95M=; b=Mu8Kmqqs9kG0tDJyLHkmQ+kb0XPp0aQZFqdl8jEb+dXioymTTIoARvjqAqRfMPUvkO PMP0aQk/fHvq28UDwQs0CKijXLK8eeuY/sLLthHkrles1GcBkdHo5qTF3M7Uc/inmFf4 2mZV2WecoNTMKra/rsU1BM0CH2bhvz1O1BsgdUZdTZ2GDPZflAJ+lA6pOdjcCS32r6XP 0fP5JxvgiSo9j/vkoTJsKlG/9BXNid4QGkfBWvtFnKEAM+vESGv6uyE2/8F3YwXkEILA 7aPXhQ8iYWkW0gcfC3G4Ieg7eEk7yyL/Sf0P3D27XZEoBtBvQxNMhH24oHDRwnS7olP2 nQLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaV4denb; 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 h21si13344717eje.365.2021.03.02.03.12.59; Tue, 02 Mar 2021 03:13:22 -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=NaV4denb; 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 S1380466AbhCBBvd (ORCPT + 99 others); Mon, 1 Mar 2021 20:51:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:48600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241862AbhCAT3a (ORCPT ); Mon, 1 Mar 2021 14:29:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A568C65016; Mon, 1 Mar 2021 17:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618639; bh=spGK3US/JfqH0Sh6+blfwSJoUcmkSbTXtspheQZBLfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaV4denbMA+w6MD+z08DDEeYN8N6dK2Pb5SiD8fDg7sfMIcyX0x9QhattqN8VrIus I+Ef+DWFrp9wyCrJfu1kviSX65SXIi7U9F3UiUPgcGvABsLplS1fMIpMGfVk3p/3AK TkAtkxNMcjdTm0cG7vuyh13bufPRD3Oc1ujYVCNE= 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 5.10 160/663] media: i2c: ov5670: Fix PIXEL_RATE minimum value Date: Mon, 1 Mar 2021 17:06:48 +0100 Message-Id: <20210301161149.689754286@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 f26252e35e08d..04d3f14902017 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2084,7 +2084,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