Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3786119ybi; Mon, 29 Jul 2019 12:35:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd6pjrptG2iCpBYNJ7JIAB1Pjpzudq79TCOWLtB+TJq7EAhaWGQ+Ib0HYZvPOuRaLxa0Jg X-Received: by 2002:a65:6216:: with SMTP id d22mr97833014pgv.404.1564428937561; Mon, 29 Jul 2019 12:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428937; cv=none; d=google.com; s=arc-20160816; b=JIig5quupCk6B8ZiItO9R/v04cTh70pMYcn5VtfAspVFjbLLMjBH1erv+LqMsZS6c7 DKshl11Frjub86bWDkJFB+BVtNM7guTSRWB56rZ7rtnPZU29n4ER3phPs715TL4AKDHj 05BFNyDHamMkZZUZycYaRRNcsiT++hoJANUYjFmWGlsYDZscIQ9cCe0BBnlxOjJql0Pr ViSs9PQFeK7W9yXR8hJE3cT/A6K7jxMF1W0AHE4OXtmC958FjXmrJtTSinLMaJnn6diS N2NXjalrqZ6zKvhP1Znet9BciG0FueBVnXm6GLdHd9kx8YoemP5y5YAx7BvC+llU4Vm5 qL9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hCtPQRDhDBb//ppJyzpqSkuIckFeD+Gj+oJ82u5iAA0=; b=rOTdZ8qK1HM2PtblYljrNRL604d75NNugEzG4DXzYiHdDashthuLSqjrAoxgQOOSUl JRGlrXn0T1zBVS5PKSAQpnTZtCiGjVNtfrzWt/6IVhgtB/d1FkMlgY3UfMH7+/TSnWiT RYv2mb6m2+/WpX5pUoZhAWFmsRt91XAi86xeYxOrD81dZ9MNjDETYPqeCwOCE2xlIthG gEBEt3x1pO9nBTZxqAY+rUD5S09C6diYf3CKMIzYwh1/TXozmXXstZSAFhqTSFlmMnGv ACdbCFBIiyi4LHR6fbjjUSlsWlrnnR7D8+CzGks2HtNV7ZROuzaPqBa42YjCgluaQM+l KUyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QETL9fg0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si28087520pfi.119.2019.07.29.12.35.23; Mon, 29 Jul 2019 12:35:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QETL9fg0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387802AbfG2Taz (ORCPT + 99 others); Mon, 29 Jul 2019 15:30:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbfG2Tav (ORCPT ); Mon, 29 Jul 2019 15:30:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5873921655; Mon, 29 Jul 2019 19:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428650; bh=MXbR2Riu2wdtV+5/uzvxW26kndj2hoEGmL1FkNpIiQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QETL9fg0vofXfc65iJBeIANcIkY65++eZlPJRrUCuKP6YzqwwDIZl/OBbfQzoMiee KO489SxAZpz5HyYYMUyd4eDxcjAtZWCzjhe7FXQNanbIxhPWJOPJ6oW3t34sYlvQh/ D2XFD2QVgU7oy6WcStehC588wWoMu9NKySVX8Xx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.14 141/293] media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom() Date: Mon, 29 Jul 2019 21:20:32 +0200 Message-Id: <20190729190835.352250698@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Brezillon commit 07d89227a983df957a6a7c56f7c040cde9ac571f upstream. cfg->type can be overridden by v4l2_ctrl_fill() and the new value is stored in the local type var. Fix the tests to use this local var. Fixes: 0996517cf8ea ("V4L/DVB: v4l2: Add new control handling framework") Cc: Signed-off-by: Boris Brezillon [hverkuil-cisco@xs4all.nl: change to !qmenu and !qmenu_int (checkpatch)] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-ctrls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2113,16 +2113,15 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(s v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step, &def, &flags); - is_menu = (cfg->type == V4L2_CTRL_TYPE_MENU || - cfg->type == V4L2_CTRL_TYPE_INTEGER_MENU); + is_menu = (type == V4L2_CTRL_TYPE_MENU || + type == V4L2_CTRL_TYPE_INTEGER_MENU); if (is_menu) WARN_ON(step); else WARN_ON(cfg->menu_skip_mask); - if (cfg->type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) + if (type == V4L2_CTRL_TYPE_MENU && !qmenu) { qmenu = v4l2_ctrl_get_menu(cfg->id); - else if (cfg->type == V4L2_CTRL_TYPE_INTEGER_MENU && - qmenu_int == NULL) { + } else if (type == V4L2_CTRL_TYPE_INTEGER_MENU && !qmenu_int) { handler_set_err(hdl, -EINVAL); return NULL; }