Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10752788ybi; Thu, 25 Jul 2019 04:44:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7fTYNQ7Z71NWyxTw8zvEA1bXO+cPBHjoSupzILJbGxnO0/w6r9Dhws41ON4W8c4fGLpeh X-Received: by 2002:a17:902:be0a:: with SMTP id r10mr85542722pls.51.1564055080412; Thu, 25 Jul 2019 04:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564055080; cv=none; d=google.com; s=arc-20160816; b=ETD3AQwcP9K8n5JItn3ittVWwBCQu5akS1byvd8/gNcsMcOlWWMC+9EXWaTC1amFPo 0ltZAryRbKZ/n3MnFoH2PcL/zjXLa2ZG/oqVl13Lqqh2977lWpFGJ0EdDmgoLbX/8btV lBbZPGTqJ35oC73Z4/0ATsWKURGPagYD8j/XOuXnekqq795VSBEbpEDwbkwg1K4zLkX8 /wcxPcoeKq8q2h6oAcRHBEbz36PdI9oOeo5rR1F+bPODLHAh9GwAaWvItBBnH3f4gkud ASnFQ3kM+jz6rPkvWjzF8p+hz6wErgvwCQpB/ocam9NysqvmAEUSeuGC4S8BgTkCnN1G 1l7g== 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=zVgaY3mYa1t18HC+vlWqsYKXE0uDwD32SmLlKGlBEvM=; b=yuaPwt5D7twgV1Z2dXV4F/a7fAOQuxHFgDm2/7sDkpyAPLHhCZTipyet76qorLtfRP U+7fAoqojS9mVHvSDA4bFafnfj7o4F1pE7qMdkY4+PomqzQFZFCxM2CJIzIBbto41u26 6wmTQx4gq2KhZRJuslvPgGx/yPCYIO+PxA92HWCCX+PVAfMUweLKcwSJr8BNk8VgLeCJ GQ5TIz7XVfar6RARlfq0dqY5RIxIaG3fEj4NZqEjb2wNOGpzQT2fWnmZCePyi3G8/FTl yHBByesBh/03k0X7p9hCOh7lcmy8xhESEITTjG6uRv86+qF3CwGwxqitzOqrLU1hy1Ce tkDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JmYUdFL4; 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 p22si18837019pli.255.2019.07.25.04.44.26; Thu, 25 Jul 2019 04:44:40 -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=JmYUdFL4; 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 S2387579AbfGYFqe (ORCPT + 99 others); Thu, 25 Jul 2019 01:46:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388109AbfGYFqa (ORCPT ); Thu, 25 Jul 2019 01:46:30 -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 3679C22CBA; Thu, 25 Jul 2019 05:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033589; bh=0EXiVRQprOa1BBEp7xxVWxJuzXshJ6Rjs1C2cOfpuGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmYUdFL4FNtWUR6sB9t9LxFAPXPfmsAE4r6dozg0UJxBRSFCIaLG6TIYRMLWpZXkf zNRpHAZ/u74WUwvVgFcWusShgJXY7IiE8VI8bARv+61fVhwrSVj4G9SFv6Gxq0nvzx 3VU4q/zRX7ldMEMDQG8LRPMDlaY0ErBv4DtYBueY= 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.19 209/271] media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom() Date: Wed, 24 Jul 2019 21:21:18 +0200 Message-Id: <20190724191712.976431042@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 @@ -2249,16 +2249,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; }