Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp830540pxb; Tue, 3 Nov 2020 13:47:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVB9eBST5x53p1mYfgWtuPX94HVrPhnUjQaF7AHhLVo41zqUef6lanvWMMU2smv/NJVfYJ X-Received: by 2002:a05:6402:1206:: with SMTP id c6mr7615388edw.2.1604440040975; Tue, 03 Nov 2020 13:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440040; cv=none; d=google.com; s=arc-20160816; b=F+tR2/Bpn8MF5bsxKqv3DIvV2DZV/YEqKe5Ec0/BLvx6+4XYlhyh4JG3Ni2W4Jq0di HQl5yUE53UFuYI+WbJTzigXLkZy6FIn2+rfsgX+Lfy8xz3DtqAZIaj9118i5TtQ9CSNP hyS3irzbBvC36+dFe0VxvDdtPoZujJBypekGiyvVoKzJeZVBqybK//FRnvsnp2kcNZly Ifat2HOKIePj1x807TGGkWaXwmIzBG/GPHK+5rL0B3nNDddRJ4jdX0AQgndfK4gffdUh hXv86Wz4TpQu5xSP9Y0oiw0ANPUP6B4ferYy2TpSYBTJ8fN+C2G/raPxrml3FkjgOZQ7 7+fg== 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=VQncEddCXPmaUqM4R8l+5XByPDyDFU5zZk9OucXRgz4=; b=dSG0+ambNjmkQWsi7zkC4sflTGOo2cbpTGLXsoBSpFHiPPnSplMR4vha9GT8wVtG0y TKqQdPmv9WalLQJ0WVVJ9UZQcUr/ZruaRAUScGh5ZvYzv51X9TDGPz/mYohanNUCLHkc rQyN/MUhKDU37yxM5RrLDp7SsDmCO8M0s9sn6Z2HPRtFIrYIP5nTr1A9QSblyaEv2fmM 3nmkEM2o7qGA0recK5LHqLJUYRywASt2T7Qi7yfU0Llzf/betDZtG+Hi7/QSomrT2zR5 pbhPVha6HXJW+CjOEbQuzmvSIxvMAQ0LM9VBD2c0Kkjvd7lFhrYpgwrzVIKrOj7L2sln gMNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VMgOSlGX; 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=fail (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 j12si13788045edy.584.2020.11.03.13.46.58; Tue, 03 Nov 2020 13:47:20 -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=@kernel.org header.s=default header.b=VMgOSlGX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732558AbgKCUya (ORCPT + 99 others); Tue, 3 Nov 2020 15:54:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:53282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732567AbgKCUyU (ORCPT ); Tue, 3 Nov 2020 15:54:20 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8F765223BD; Tue, 3 Nov 2020 20:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436860; bh=PKXvgJAXqK8j6bX7Dlte8tO2NmsT5qMcDgFiPVCEyCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VMgOSlGXaNomCioEtUIWd93Id9tRBlsjp/N2J0pzYwCE0U+VilqE/r+xmjCwnsPM+ 9bPMG6pXTjzauz301v1baBn2q4JLddDMoIJto5a/CbIWzDDuAaioij8wsKsC8/PoY6 sddxUy2fvPziBk2dqntwZ1K3QdF8L1D+yV3AorNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 043/214] media: tw5864: check status of tw5864_frameinterval_get Date: Tue, 3 Nov 2020 21:34:51 +0100 Message-Id: <20201103203254.131220594@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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: 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 09732eed7eb4f..656142c7a2cc7 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.27.0