Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1030206pxx; Tue, 27 Oct 2020 06:43:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw765CfRzHHX5hvgjYE0xNbZY1mFj3VHl/HFkARIeFy20hWXRBBztvTDq3zOpZLg0UMpAmN X-Received: by 2002:a05:6402:1158:: with SMTP id g24mr2239402edw.323.1603806237720; Tue, 27 Oct 2020 06:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603806237; cv=none; d=google.com; s=arc-20160816; b=aXKPZO4KEIMDJtWYAkKNwveMseZsp9lSrLt/KJ7D7fTrSTybrRv019zSLs2GDlqeaq TmRu3kwX4eEylIi9C2u9QnPTkY9ojqADMccIpYAAyEmVmPXPolMFSLBj7u49eS1lYFyC tASVqjVmymET86hQ1ASTKC/7UD6nDgc1PqfE3wlbt+ZzcRoKl2Mf15Go46Xfqw2fQoE0 LUHuF1a0U5/59KigEXkDTQGujAAhtOOI9tqUfvdtmJNlm6vTU1LcHPV9TIwkyOVSs/yP gYz5od5hp3jgy7pNcemtOjKFl029qZViO3RGN8wbbNNXNxz+hLloWWXy5CrFAHGCyUoc 1zkw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PZIuY3Hcs88dWitGLBS/gfE5DODZ8em7DeSwFn4oOf8=; b=uAA6WrIMiVnjgBpzIcK+d2qdVVdrefHyyVwgHw4nUQpvew7c8kMaSLP8NqkW2oQ4W7 /ZTMHdFY12yc9cogg0temBU/mHp1Cghxq1/XyU6jnHSOFgPhFZZJgVSfvnQyNt/x/u37 bwm/B7Tq/4jq1E1KwtGdqu8pk+v/FkpZTxBdjFi0HOMNn4Rw8gn+64zLi3mt+ImRBzPe vWpESxYaQUR1uxnC1DxctAHoZ4kSyJnHYdpdw/lh6p8hFOS1zRMNCgn+Ag+20ZP+EWny TnmIcSvFw0vZrcZ9ti4rrVP2ZpcF/8MxVUXLF4P/cgXlFOozCtbpgz4ty0FE7ujztIS4 AVgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j42e3FcW; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh5si1025875ejb.506.2020.10.27.06.43.36; Tue, 27 Oct 2020 06:43:57 -0700 (PDT) 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=@kernel.org header.s=default header.b=j42e3FcW; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444486AbgJ0Aiw (ORCPT + 99 others); Mon, 26 Oct 2020 20:38:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:49012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409017AbgJZXuG (ORCPT ); Mon, 26 Oct 2020 19:50:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2AA8120872; Mon, 26 Oct 2020 23:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756205; bh=kI8a4ZAt7Nnbp8EYD8u1w6iA4ykp9eMx63jY/V9xDyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j42e3FcWw3Chkw3b9WmVUxdrJUgmJUWMrlAoE3Q3i8G3bALheQYjNukdwvyBofSqK dz+AVAwDQQxWjYRbIpvaAt63R59YbX5w9AmYoQXrl0Szls4eh3MeRh0yPEzMQ+6svB X5g7ooFf+9xYbvmDT9sMR2OYaKhVwvRu/B9vpRGw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tom Rix , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 5.9 048/147] media: tw5864: check status of tw5864_frameinterval_get Date: Mon, 26 Oct 2020 19:47:26 -0400 Message-Id: <20201026234905.1022767-48-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix [ Upstream commit 780d815dcc9b34d93ae69385a8465c38d423ff0f ] clang static analysis reports this problem tw5864-video.c:773:32: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage fintv->stepwise.max.numerator *= std_max_fps; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ stepwise.max is set with frameinterval, which comes from ret = tw5864_frameinterval_get(input, &frameinterval); fintv->stepwise.step = frameinterval; fintv->stepwise.min = frameinterval; fintv->stepwise.max = frameinterval; fintv->stepwise.max.numerator *= std_max_fps; When tw5864_frameinterval_get() fails, frameinterval is not set. So check the status and fix another similar problem. Signed-off-by: Tom Rix Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/tw5864/tw5864-video.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index ec1e06da7e4fb..a65114e7ca346 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -767,6 +767,9 @@ static int tw5864_enum_frameintervals(struct file *file, void *priv, fintv->type = V4L2_FRMIVAL_TYPE_STEPWISE; ret = tw5864_frameinterval_get(input, &frameinterval); + if (ret) + return ret; + fintv->stepwise.step = frameinterval; fintv->stepwise.min = frameinterval; fintv->stepwise.max = frameinterval; @@ -785,6 +788,9 @@ static int tw5864_g_parm(struct file *file, void *priv, cp->capability = V4L2_CAP_TIMEPERFRAME; ret = tw5864_frameinterval_get(input, &cp->timeperframe); + if (ret) + return ret; + cp->timeperframe.numerator *= input->frame_interval; cp->capturemode = 0; cp->readbuffers = 2; -- 2.25.1