Received: by 10.223.185.116 with SMTP id b49csp2210383wrg; Thu, 15 Feb 2018 08:09:23 -0800 (PST) X-Google-Smtp-Source: AH8x225eZGRB655bFkn7/F5Dr6R3I/H30TI52o7VM2Hud7jAbae4XXu3Y5fxtpkgLFCvHBfVkanb X-Received: by 10.99.191.78 with SMTP id i14mr2672372pgo.9.1518710962940; Thu, 15 Feb 2018 08:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518710962; cv=none; d=google.com; s=arc-20160816; b=eJ8/uUP1oLWZrBIK1bCywXdyOMyfQ3NIBnYKxWiUe8LjxJ7aDEWnCBGfo/L+hWqnsB qtOm7CEWcaWFyfu8ADes4Bc67MAACEZnyXnJeEcSCoJdegu3TD5Wbm14dbWI/cvOnRkJ yZ1jnDrsOILyXdtgAfhGJQf7As5/XolswRkrdKkFLqiQVFPoG2fFOAE5i2Ml9ulh+FgR kPdCmBdAUjCXvXhh4kDFDmv+D3+IkZ7nFfOKGsdeQAnWmfFmI6aylpZW70w1DJjYyqsb BTnyIEgF6sf6RLVnfy2gpDfG7/edbu9wyqKR1K8Nkno6IG/BBD2CZq1dOf58CM2RE5WN cRuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=XU8209RxCNHEvexlNBXx4e2aAXFqXcYIR1JcQaWpbyg=; b=gTe49inEhyEKdRW6nhZ7ANzfpZCGECOOVGLwXptPof1i9M4n1rhinPGMEiISe3Ywuc IPoworLqe5kxsRtYK1jeLyNuzzx9hjLRLC4Cqd28g5kTSd62Glw9CE5dxXT1h7jsPf7I pAWMmyAzBXEXxM5i6vCJdGUwC4O8rh0OxCc9msnxYEnPNr2/YFHTINLcqpulM+diBIsG 81j5K9hkBRtVFOOm2bmS8D7ouzIastB/LOrzh/sJz1L+7VIWMCcmk0XVLrZFc/t1Igs0 efmAoPG6ZtUXQqnJFyM9+w3el/zyUcb8Jow14VB7shCh61uhVtDM5/oTyFTxX09+R4zL wUYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p33-v6si607673pld.310.2018.02.15.08.09.05; Thu, 15 Feb 2018 08:09:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034028AbeBOPpm (ORCPT + 99 others); Thu, 15 Feb 2018 10:45:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35034 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033898AbeBOPph (ORCPT ); Thu, 15 Feb 2018 10:45:37 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C917B11C7; Thu, 15 Feb 2018 15:45:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab Subject: [PATCH 4.15 153/202] media: ts2020: avoid integer overflows on 32 bit machines Date: Thu, 15 Feb 2018 16:17:33 +0100 Message-Id: <20180215151720.959645374@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mauro Carvalho Chehab commit 81742be14b6a90c9fd0ff6eb4218bdf696ad8e46 upstream. Before this patch, when compiled for arm32, the signal strength were reported as: Lock (0x1f) Signal= 4294908.66dBm C/N= 12.79dB Because of a 32 bit integer overflow. After it, it is properly reported as: Lock (0x1f) Signal= -58.64dBm C/N= 12.79dB Fixes: 0f91c9d6bab9 ("[media] TS2020: Calculate tuner gain correctly") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/dvb-frontends/ts2020.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -368,7 +368,7 @@ static int ts2020_read_tuner_gain(struct gain2 = clamp_t(long, gain2, 0, 13); v_agc = clamp_t(long, v_agc, 400, 1100); - *_gain = -(gain1 * 2330 + + *_gain = -((__s64)gain1 * 2330 + gain2 * 3500 + v_agc * 24 / 10 * 10 + 10000); @@ -386,7 +386,7 @@ static int ts2020_read_tuner_gain(struct gain3 = clamp_t(long, gain3, 0, 6); v_agc = clamp_t(long, v_agc, 600, 1600); - *_gain = -(gain1 * 2650 + + *_gain = -((__s64)gain1 * 2650 + gain2 * 3380 + gain3 * 2850 + v_agc * 176 / 100 * 10 -