Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp634546pxx; Mon, 26 Oct 2020 17:36:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+gETB8gjPCUR/eqtYBGOD3YFUgT5E+/nmFlKrGp24Jaw1aMCNVP3T5jD49wPCogi2UuLK X-Received: by 2002:a17:906:745:: with SMTP id z5mr19305361ejb.408.1603758968370; Mon, 26 Oct 2020 17:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603758968; cv=none; d=google.com; s=arc-20160816; b=nbeIo9q5bu9Fh+C2rcBVWe7cdCR0uvLwHaQ7wP9TB/Qt8sXR/fUc1z5DMQCRvY7Bjf Rh/Z3PiRJ2IdmGfhaJWLKjqoRPQVGK5GT+VcKZFIGpDu7l/C9VBni+qYZ7mNxKoaK1XR HLswOFDUhqTm4MPQfeuSRWvzDBeTb+MneuyGyUloUiPaXPvHv1ZyWTHiEbGE/KRyqvhU UqNY7akJKo2BcQ3EehItDbNz9Hr8LWoRcbwD1heQvXGFUxq0ZSjI1jzZi+/1iYPDRNGD rm4k2t6BYYGTsOg95Ckf43qgEK8B3l1qdP032iGgJYSK7lOD4LOUw1dyvIPpXbIJaSj7 RolA== 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=8W5KvzsbLI1RZgacQlF1ElBzX1kftMdHd8mhXKrOp1s=; b=fYk1jzGhenZtm4Jdsz+vEDa8RImJRKSdhDJQETtMTLHMuziteb5Vjt0WZ3X6YfWZ7V FXWhxIGOioaBeSBSYd/nmzg14jt0XQg/cqzp+4ZkNsXPpqrHGyp5AZdaZ8wZD8F8R2fG x+1YLG1SltWhLe7tKnZqUjXmLr/STp4+nmcP/xyk1j/W29Cn6YltTH7bH88OsGl92Aa3 DBw9f5A8aITjVdQ1SOOigli+/fTY7FVb1onOLcch6OurzrpcMLknd9WJDzuaJm3id5D5 m2T08GhqeAfEkU0aC03xkFX50varPh5pPl4Q+2gNjg9uA+EHcQnR4qzQfAYJvJVwYZMo R9JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="QtopRAX/"; 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 u10si7459984edd.315.2020.10.26.17.35.46; Mon, 26 Oct 2020 17:36:08 -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="QtopRAX/"; 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 S2441295AbgJ0AWO (ORCPT + 99 others); Mon, 26 Oct 2020 20:22:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:34626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410962AbgJZXzr (ORCPT ); Mon, 26 Oct 2020 19:55:47 -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 E3A1122242; Mon, 26 Oct 2020 23:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756546; bh=HCiPYBeaQLSGD6/3OWfDL/zLVxU5ya9mC8ZtFhltUhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtopRAX/cR7ghBqePyiutJB6ANQaVzJJ3B4NUytUOS+6VTs16zCTVBWZ7Xu93g6Ce WjTXp2dZ9N6WQZ3EkTw1HzPPEYRxjMY7vcmgjgW6djng1CJTECpaLryyrEgHZ7+Xgz D2L8N8oBl9qaSeo5Ro8+qNZngnbwQvT0sEVVOdMs= 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.4 24/80] media: tw5864: check status of tw5864_frameinterval_get Date: Mon, 26 Oct 2020 19:54:20 -0400 Message-Id: <20201026235516.1025100-24-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-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 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.25.1