From patchwork Mon Apr 29 15:05:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13647206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBCDFC19F53 for ; Mon, 29 Apr 2024 15:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bK30URgvbTbv/+6RC5dElcsAfzChmheMYFYS9URU3PE=; b=qRA9Bp4Vt5kZDv mJWLV99tvCa355xjgPc4k/YoH+rbudovrpazHPAw+kWb//7Vpbd+WnfMspULxNik5iqIMrY8OgRCu hHAG28s3Yuo0uT3DiaoNHFCWTSCASlS+epW0BQQbtJaXuPxCy3n8bIs58Ve5PAaxCUgdEzd+wKy3A vWT3ZSi4bQBvctY0NOXSJqBXqtvWLYWmRbz/h7cs7nJeOn0fXwhm0S5+jNkOkm4Zw31T8RbROjxej F/z3WJfHfCbGNu8Z2/RwJq5X9E3aXuek4teC33yLv6uleleEOZeGkgEPSkAxekd/sJvjOBHPCnNLe dWpU+JsgO3OQYI2RS9lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Se4-00000003IwJ-2vBT; Mon, 29 Apr 2024 15:10:20 +0000 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1SZ6-00000003Ff1-1K2h for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 15:05:14 +0000 Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-790eedf44faso116876385a.3 for ; Mon, 29 Apr 2024 08:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403111; x=1715007911; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=STqazHEagBxWlHC69lQFp5WbvQ2Sdx8rB6+uKcUB0cU=; b=kdDIo6RTE0kYIgyOuv0Ofmd+4m9/txXllDc0zHr+YcwjXT4aUvmyksDY4TrbigKkBB VpCnCm6TVwErAIm3KrhF07Usyva5z9+JbUFykFSBzNKaYMKJ3mV6hG7dStqFTGG5/ZDw RdnwUvhLpTcEFC/bUonVvjjO2FEu0IjQv/A2w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403111; x=1715007911; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=STqazHEagBxWlHC69lQFp5WbvQ2Sdx8rB6+uKcUB0cU=; b=XSqh26VNTtsP9CiRYjGKyZBB4V1xoIxQtwAfOUtwuwKuA5ARlTFpCS5qJ6pD2+owfN muZ8v1REFuxuIn/lMDLQ9jJoRB1FnICVzo1b65Sv0hG6sz1ACMavGsasA8vs3hXJg4cU HDBAv7ZP2wku588YoEW4OxGucYUhtmjDT6iszL9zR4Epk3/bQngZsuyh4eOHX8UCaJ+U +TBR+Ro6hCPN26BuQ4Vmf56IqOS4eZ3moEmxfHxEHrcda2ffBtnXXHOWnNLiMxFk/W3W 8X7MQ46JtIjGQ7/MKF/M7VRHc2sdhERaosrDQ1wrQTtngyQqofrDTu0qIpTfnsRR8di+ 3AMw== X-Forwarded-Encrypted: i=1; AJvYcCUqHvIL3k5gHCQTJ98VJkR/9KqmjxFD3EOZ2cf5oSMF4yXF2aF4p1QHmLpGf0H8uFmCwGG3mq1fAZne8C0uln9KCmiaYTXI8sPiT+OmEuSK32zL0AQ= X-Gm-Message-State: AOJu0YzBM1qkNOnsK9N0d8BMK2Wju3vIRMjXjMb83lh8OAcSb19W/jPx KjJg7GtF/MPHa2DZlxEa0t7beMhVGjA8yycBvEpupTjaMLWtTdXXXI/PfUkXfg== X-Google-Smtp-Source: AGHT+IHvPitwm/34xW/kQUa8TA8n6UCg3fwO9ex2lf7MaH+MC5XxlTHiUGq0Riy9QnEe78dxXREmpg== X-Received: by 2002:a05:620a:5e48:b0:790:c81e:7840 with SMTP id ya8-20020a05620a5e4800b00790c81e7840mr6919928qkn.12.1714403111405; Mon, 29 Apr 2024 08:05:11 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id p7-20020a05620a056700b0078d3b9139edsm10568591qkp.97.2024.04.29.08.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:11 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:05:05 +0000 Subject: [PATCH v3 26/26] media: dvb-frontends: tda10048: Make the range of z explicit. MIME-Version: 1.0 Message-Id: <20240429-fix-cocci-v3-26-3c4865f5a4b0@chromium.org> References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> In-Reply-To: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_080512_616453_70A4A33D X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We do not expect the sample_freq to be over 613MHz. Found by cocci: drivers/media/dvb-frontends/tda10048.c:345:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. Signed-off-by: Ricardo Ribalda --- drivers/media/dvb-frontends/tda10048.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index 3e725cdcc66b..1886f733dbbf 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -328,7 +328,8 @@ static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz, u32 bw) { struct tda10048_state *state = fe->demodulator_priv; - u64 t, z; + u32 z; + u64 t; dprintk(1, "%s()\n", __func__); @@ -341,6 +342,7 @@ static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz, /* t *= 2147483648 on 32bit platforms */ t *= (2048 * 1024); t *= 1024; + /* Sample frequency is under 613MHz */ z = 7 * sample_freq_hz; do_div(t, z); t += 5;