Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1722117lqm; Fri, 3 May 2024 04:57:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0nocrhK0obchXS4hidR7X/221Eze9SBoK0V+dNN6CUm4gbynwmtqCIVIpE26bTEWwMU17bNdNuGrh46KNiNVuvbbhRQ5HJ7phZySHPQ== X-Google-Smtp-Source: AGHT+IHyrIjclknzkOYBI3FyzTgPTx2LjUY+u1xtj8leSxmq+oR5KB54mZ4+VVbOYDIgEhTlDNL8 X-Received: by 2002:a17:903:32ce:b0:1e4:6519:816d with SMTP id i14-20020a17090332ce00b001e46519816dmr3194846plr.48.1714737464285; Fri, 03 May 2024 04:57:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714737464; cv=pass; d=google.com; s=arc-20160816; b=x+bYbBXG6dXwrHDnXJcjU08Uoqxx/DZHlcoJXcLnbpnvfrz2ZdZlXUkaZebQSm0/NS 8pBhkPadkk7/73iNGaCWpvt/Shg4+rLCd6Py5lvBukpWCQaypjtUMAHTDsI+PkicKK1s mhC8rcWjXiC8wl6fm3z6yp2oDy83cZh5Cnbd5CVvAf1NsVkV5YW3A0kddhp0YLGPbzqu HlUclr9wYrXCReF0RAhukhCyKmQRM0voMOftn0wv7M2iOD/ZpEt1NqNZ4rv8IDVZ1lsd MZY9OUddkKNOTvKdkPJCrCt9IXCyx8RbJTTGCuwUyQgE+TOTNhtNZXlQqBA9t7VHnHlb eIPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=K7hPKV3HF7+4pxzh8EgR7k2JkSmFNYuW+tKLwH6I0Lg=; fh=vIdM7lKzE53Tjk/rOUInbDy84WX+rOeOLnYVcJvvKsY=; b=hvfG8ZN8B8YYd7zKnaQaA0CO7HDN6JbdOP8MPmglg1NnmfdXiVrANK13XLB3HVPFbV OlmPHbVQr/7tWH9MF7/LTtZni8O89mwNDf0oJvWfZmbDodx4kQwdEbU0jfdrgfl8p8y5 kRnj1uN2+JYgS4Hq3vg7kL7o+JE1FKfIc8QXxC/y1nNIdilNZtKfvM2zmRdUdE7Y1a1k pWCpa9ZUzjeFYWhZgo9wV3/ctw+fhWWUSDQkuQvOdFsP+jgWwWpWZMnro6234Vrq2p05 o9yKclHsZvQg7/O+MfbUZ4dgbVnA2OCx9axCrmcoGy/PDkmj9Ys3LvV3YCb9vtEeqwc8 aODA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ee3ChdEh; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-167613-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167613-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k12-20020a170902ce0c00b001ec449d03fesi2815609plg.605.2024.05.03.04.57.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 04:57:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167613-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ee3ChdEh; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-167613-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167613-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2C84D2816CA for ; Fri, 3 May 2024 11:57:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28C8F152E1D; Fri, 3 May 2024 11:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ee3ChdEh" Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C236E152DF0 for ; Fri, 3 May 2024 11:57:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714737443; cv=none; b=rnQhZ2WqwAalnVAa//2Lq8RUwoHsChZGBhXLh7jxLalteAFA+NhG0pHgqyW/dv9qXefyJa3quj/UzIZt89xRH5jc+uAg8LreQbHDPxyBt4zQmB/IDM4AMcrfU7pd4leoJgi2dCM4GJzWiELoye6vv/YREz3fHj300p0zPDtW6Wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714737443; c=relaxed/simple; bh=CmcuBbTVhho6EBimKTWKrm1lTdbe7FzUQrr9f+yUs1U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XTjzt9VGsyKswrehhmmZbW/1qCd13ergMJAbj7Tvp1PZQ93jjJUt+sAfOx6MEiGfsHDSl0vWqTHUCsX4hyn5rENu/NLYEugIKbQW3YeqP4M4OcCuAzkdGCwbAx171APAT/ixaNihMTSVQnDtj1BwJjEp2AEIS88+Z6ID0AO1s4g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Ee3ChdEh; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6f44dd41a5cso326570b3a.0 for ; Fri, 03 May 2024 04:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714737440; x=1715342240; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=K7hPKV3HF7+4pxzh8EgR7k2JkSmFNYuW+tKLwH6I0Lg=; b=Ee3ChdEhqgMcMnYD+98HDx2vIaePiS4F8ej72udYqhX68vnFv7st5bt2/2MPVLsXR8 jOIM3PdJNsZy/omnxG4Uz5S3OJN9ebb710IRuYS7eS5l+h1iIGUGsuP6UVfHwaghY3xY DYChXe3C90vExbTk1fbB0ndJBWVPaVz5GBRNY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714737440; x=1715342240; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K7hPKV3HF7+4pxzh8EgR7k2JkSmFNYuW+tKLwH6I0Lg=; b=UjwNsbW7WVv2fcliiOzvikCH6CVJ3LP8m5Or/VdTWWa4r1n2tOnB18x5Q/VxFFCmhP EsGssrTYatRqjNX3wSaOdf3dY8+uG1dfn/IM2YJTG7aW4lOzYgTneETAuRtA2bFv6BYK 19xO4JhQipnElfONpTwDoZlXB6aWftPYHbPDr8AdGSU/N8cljpUlc78UUEZbxeGqVgxM NoJ+1j0fK7U/505MNiF292D+a7tnOMeReDl9VwOQzwxx+vUsmewWFrylM6aKIc9PhN59 l6tvTYo7wTWqEN/sXg3uIM1V8VRBuSH+KohoV9QpubyWc06Nwt4nxOcaSujNhoY0F0Mt P4sQ== X-Forwarded-Encrypted: i=1; AJvYcCXMhNdi/ZNi6f9n7TMcpaaqAkNgajpN1rRr9wqMM3szMDwC+HK2spC7l9Mz46UWr/f94pVOu4r2SdjWssIsuBl9MpA6FSFIi987lSx+ X-Gm-Message-State: AOJu0YwupISpWfClk4hdZOyIyqFuYDgzIM4tF3KdwtYa8QHOYBewDGES WWlkTn2KQ7ZHQ/fAlwMcOb27FJ7VYkg7WkDV+r3tyffba9FAXnJKoh4qXKjnAZwESBKB4IkWfJw DIw== X-Received: by 2002:a05:6a00:2287:b0:6f3:ee4f:e28a with SMTP id f7-20020a056a00228700b006f3ee4fe28amr2306793pfe.32.1714737439786; Fri, 03 May 2024 04:57:19 -0700 (PDT) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com. [209.85.214.171]) by smtp.gmail.com with ESMTPSA id p8-20020a056a000a0800b006ecc6c1c67asm2892448pfh.215.2024.05.03.04.57.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 May 2024 04:57:17 -0700 (PDT) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so89514005ad.1 for ; Fri, 03 May 2024 04:57:17 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWCgD96Ul0LW4v5LX0T2fcgeXOAmFuVv/99V2TymEW9vlAbRP+sRO4aje+mTjqwNP6mlUry/Lpill4IZDcQ3942zJFGYTFebO+LuFEm X-Received: by 2002:a05:6102:2329:b0:47b:d717:b689 with SMTP id b9-20020a056102232900b0047bd717b689mr2266975vsa.4.1714737415965; Fri, 03 May 2024 04:56:55 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> <20240429-fix-cocci-v3-26-3c4865f5a4b0@chromium.org> <20240503112758.763d8d31@sal.lan> In-Reply-To: From: Ricardo Ribalda Date: Fri, 3 May 2024 13:56:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 26/26] media: dvb-frontends: tda10048: Make the range of z explicit. To: Dan Carpenter Cc: 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 Content-Type: text/plain; charset="UTF-8" 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? Thanks! 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 > -- Ricardo Ribalda