Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3212655pxb; Mon, 9 Nov 2020 05:44:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFg9UfnfKQGVZNECM25aNJh2M4yIRH/BJYNpbY2KogTJJW9JK5C89CUwfX+BGyWkbhgLTU X-Received: by 2002:aa7:df04:: with SMTP id c4mr15485993edy.25.1604929464464; Mon, 09 Nov 2020 05:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929464; cv=none; d=google.com; s=arc-20160816; b=m1KEROnLRdqgdIfCNwEZyJ6PYdY3SfM2Cls/kGiCi0m2h90UQaWhjQboMDODY1nWe9 8uv2xM0GTqEvAYXsPDNmf5hAOKcm2GVWTuyB2girlBSVfnhztsRS3M0XTQ8hJ6Duc+2i JImdapQWgthFdZtVYbbtM7m4lSMqYdUzlHz2DaucEWrf+CjfIn4wQOC10o9A1lNSFDbO ZqoypPtfZNC9j68oi6iD8XewFgb52A0+C2iTskr3N/Qrl9QTm3c2+a41NZZCyCew05kR TdFpYbpJkuO1IVtNRH0X9TsmyW/pUqLnMlB5YCtGxNSnKbzSCeZHBOeK7bIlvTIlv/xC buKw== 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=VEY8jqqbcD9trSrQobzpVwQJlflXQ4B1CvxGzQFcgoA=; b=jptalr+LwYeEyz/BUn+1tQgU+26ybftG8ETWwu1nLJ8x5dStzo8Gbel3u0tNWfSjjH /sCPc3LkE/ckhL/LCxY7TTFOnrlAOlfqZAH0EeUXdGuDioHdvL6gAPf1crTi5pCWMqF4 EGchP6G6J3ZfJUUYjTOxX/yrb7nO1wvI0+jLpmqwRV+3kMTblabmikf8W3QXn/GIlW0o P9sFjfXbeFqWVPQnWLLkDYirfUKE4w76CJQVcz4LUn0sHInKHPbdAxxVWC2yNpmQwkBr VULba86Nll8lWnjT9qrGsr7G4neRhiCO/I1FggVeD5X6FVIgyFOlMSA1ln0DJ77cf+sN kkBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aZ3B71oV; 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 27si7018091edw.379.2020.11.09.05.44.01; Mon, 09 Nov 2020 05:44:24 -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=aZ3B71oV; 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 S2387901AbgKINmg (ORCPT + 99 others); Mon, 9 Nov 2020 08:42:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:54938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730526AbgKINAs (ORCPT ); Mon, 9 Nov 2020 08:00:48 -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 7CFFC208FE; Mon, 9 Nov 2020 13:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926847; bh=UTcSJl5ekP8ZWhoX//5eD5eN4RCVhhFGs7KUHUXpxz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZ3B71oVf0NZHZwbJqJoiywfMOdc/NrVHdOIWYK+ztmySPPug9ckqiGun1M785UEd q21lDILhMAexlxIHJXs3zm5UatYnhrdzDAAejhHvKBb+yYNzMWDuIpoAvSFRS/ZDOn LDyo8ROxwxxTSeLglABieu8oLZbnunIRCtL6uoIM= 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 4.9 025/117] media: tw5864: check status of tw5864_frameinterval_get Date: Mon, 9 Nov 2020 13:54:11 +0100 Message-Id: <20201109125026.849551537@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@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 27ff6e0d98453..023ff9ebde5e7 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