From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.manjaro.org (mail.manjaro.org [116.203.91.91]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52F44152184; Fri, 3 May 2024 14:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.91.91 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714745335; cv=none; b=kwYjWZfsb1Qr8tNkPaLn+5Ce/dVIp0oPZRiaHUtHTkF7lXQJ66oy4jUHJ2bS58FnCtE/uP9ZRImCddpmsViIzlUAmq5qW4NhnaN8fwQpK70ZNkdfrWR4x4Krr8JJEutd/YCTaZ3LsDND6AqupxsYCxbXsNvY3Hl9EdYsJdyC5b0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714745335; c=relaxed/simple; bh=+kPnKcYBQEaIz35grdcmnn1EGJxQ/kAtMsbVmsDrItw=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=j04s6tX3jVPT+YUacflG2Z+XvmrazAijJQc+Rgt/wq/YuXrB9sdfyzHgqv1nTYLufHgrkjhOt5imlYzQu/HmHN+QIteEMmPDp9OMcCx4uSxG1XZ3dDtuWLjPcKrhpdq8PQLbzf1Ev+ZEYZdVSvmXeLfMlpFsME5QIsTaNQmDaF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org; spf=pass smtp.mailfrom=manjaro.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b=mAarC0LY; arc=none smtp.client-ip=116.203.91.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manjaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manjaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manjaro.org header.i=@manjaro.org header.b="mAarC0LY" Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1714745331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3C+MgtjD5FFzr1H8ErTkKFFC7gX/7QwO2uuYNs38Akc=; b=mAarC0LY0zCqC2ZrO6f/B0kd24XVsuHukHHUkTxv8x6uP89ukwITU0O3Ynvicd1D1E9pAe IO3tmU10O6igCP8QZy19eeUc6Ld3IxJqvuNP1A5HBT6M5ThYS4BpN1w2gd1THv6O1jAK7/ ezGJ5lRjzzWduiC7DpEa6et6y5QamPHTjx/cHxFoa92YbVL3l6ufWF1RIr8LLxjgxMNHq8 xLmLl+oEm7sIthlsxDBs1Nx//ZO6J02vTNuOw0f8VgzJgXGDL/8MklHPqBILGlrXprDE9w hibkEuHJ/OUQOHG1dbrTz8I/N/GLzP9y5rNue5qKcnd9Fy1V2tSamIAR/DWm+g== Date: Fri, 03 May 2024 16:08:48 +0200 From: Dragan Simic To: Ricardo Ribalda Cc: Dan Carpenter , Mauro Carvalho Chehab , Martin Tuma , 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 , 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 Subject: Re: [PATCH v3 26/26] media: dvb-frontends: tda10048: Make the range of z explicit. In-Reply-To: References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> <20240429-fix-cocci-v3-26-3c4865f5a4b0@chromium.org> <20240503112758.763d8d31@sal.lan> Message-ID: X-Sender: dsimic@manjaro.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org Hello Ricardo, On 2024-05-03 13:56, Ricardo Ribalda wrote: > I am trying to get the DS, but > https://www.nxp.com/acrobat_download/literature/9397/75015931.pdf is a > dead links now. > > Anyone have access to the datasheet? It's kind of available on the link below, but for some strange reason the download fails after downloading the first 128 KB or so. https://web.archive.org/web/20080907185532/https://www.nxp.com/acrobat_download/literature/9397/75015931.pdf > On Fri, 3 May 2024 at 13:55, Dan Carpenter > wrote: >> >> On Fri, May 03, 2024 at 11:27:58AM +0100, Mauro Carvalho Chehab wrote: >> > Em Mon, 29 Apr 2024 15:05:05 +0000 >> > Ricardo Ribalda escreveu: >> > >> > > 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 */ >> > >> > Are you sure about that? Some DVB devices have very high frequency >> > clocks, specially if they're also used for satellite, so I can't >> > be sure by just looking at the driver's code. >> > >> > Also, we had already a bunch of regressions with "fixes" like this >> > that actually broke frontend drivers. >> >> This patch preserves the existing behavior. The sample_freq_hz >> variable >> is a u32 so, in the original code, z couldn't have been more than >> U32_MAX even though it was declared as a u64. >> >> It's possible that the original code was wrong. We have seen that in >> other places in this patchset. Adding a note about the datasheet is >> also a good idea. >> >> regards, >> dan carpenter >>