From patchwork Tue Jan 30 00:31:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10191167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E6A860388 for ; Tue, 30 Jan 2018 00:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F788288FD for ; Tue, 30 Jan 2018 00:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62F0028902; Tue, 30 Jan 2018 00:53:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8A44288FD for ; Tue, 30 Jan 2018 00:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbeA3Axp (ORCPT ); Mon, 29 Jan 2018 19:53:45 -0500 Received: from gateway34.websitewelcome.com ([192.185.150.114]:46249 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751787AbeA3Axp (ORCPT ); Mon, 29 Jan 2018 19:53:45 -0500 X-Greylist: delayed 1418 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 Jan 2018 19:53:45 EST Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 7BFB71E5136 for ; Mon, 29 Jan 2018 18:31:21 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id gJpZeO0YTODN4gJpZeJabx; Mon, 29 Jan 2018 18:31:21 -0600 Received: from [189.145.57.174] (port=35450 helo=training) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1egJpZ-001dlT-5j; Mon, 29 Jan 2018 18:31:21 -0600 Date: Mon, 29 Jan 2018 18:31:20 -0600 From: "Gustavo A. R. Silva" To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH 2/8] dvb-frontends: ves1820: fix potential integer overflow Message-ID: <2bc8d41c5ef755fbbe3f3e06c427928b97ed4731.1517268667.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.145.57.174 X-Source-L: No X-Exim-ID: 1egJpZ-001dlT-5j X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (training) [189.145.57.174]:35450 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 16 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cast state->config->xin to u64 in order to avoid a potential integer overflow. This variable is being used in a context that expects an expression of type u64. Addresses-Coverity-ID: 200604 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva --- drivers/media/dvb-frontends/ves1820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/ves1820.c b/drivers/media/dvb-frontends/ves1820.c index 1d89792..9dbd582 100644 --- a/drivers/media/dvb-frontends/ves1820.c +++ b/drivers/media/dvb-frontends/ves1820.c @@ -137,7 +137,7 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate) NDEC = 3; /* yeuch! */ - fpxin = state->config->xin * 10; + fpxin = (u64)state->config->xin * 10; fptmp = fpxin; do_div(fptmp, 123); if (symbolrate < fptmp) SFIL = 1;