Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1131404rwl; Fri, 24 Mar 2023 06:45:05 -0700 (PDT) X-Google-Smtp-Source: AKy350Yxd5/308oVGb3WyaNrOo7HvjVNJ8GaI0Rm3fBOepRc+ae5nU/0nHCGlu4yazs1IyVwxlFe X-Received: by 2002:a17:906:5d0b:b0:933:3aa7:57a7 with SMTP id g11-20020a1709065d0b00b009333aa757a7mr3132464ejt.49.1679665504809; Fri, 24 Mar 2023 06:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679665504; cv=none; d=google.com; s=arc-20160816; b=kKzYBFauj0NqQvBSsnylKCKYcZncyQ7nRuP7FvE6nZE56b2jAzY7dvpbRX473hfMEP O3LgUfwEPOyLzzR8/jjbHYyshjVC7tnlmr/K0aVRIm+JhDapmn6+cg9e9LdGwmd7EoXD ORi1U07I6Md11VpkRm0QLJeLFoIlCsYBvAc+GqsOCfvUPxDWo2f3CTRJapyIDJyRFmpB aB4gfJLup8nj0gf/4/SahFqJp82chf7NWDSbIx3zIcbRebkrlSyTis4GFef+KAhnN0Lg q7TYhA0efNNvtoM0tdyXdLS2CwhIUSC2wn4THuFvqj95UTligJM2P68I/2HSqlgMXoMI 1juA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6obpWcG8L5pnbqXjF/2pt4wv4MwcI22WA/+bL98pwuM=; b=BMzAHpBYlApfaIFDZm2wuBAQkSCU8gUmo1ReTh5WKTIgBnMeWQGthMzrMkgp8hk7BO ZWJ/aC2qJn/qepyNTrq3YOMiO5NiT1fXhO+Wki0UDBCMEZMeeHsYuvnWSSf3NQ8TdA2/ u+n52197GUjuDUCNPl/nhzBpTBdLHSv65IdFO+Iz9iNHsNkEPcV6eN2IyZSZuW5XBxaj 55bsj2ed185adjxdgoE48cZqpGIfR7H/vTgLjAFHNOet0eWAeFB/KEPeTMJfy2spbOM1 I4hJVJa4f8s/8h/gvOwUTeoz8ZC6beqe/grZG3P/+AeDJMShCaOWBzlUWOVu8ki0JClZ 4blQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020aa7d8c3000000b004bc501f34d4si18917786eds.250.2023.03.24.06.44.40; Fri, 24 Mar 2023 06:45:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbjCXNiv (ORCPT + 99 others); Fri, 24 Mar 2023 09:38:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbjCXNit (ORCPT ); Fri, 24 Mar 2023 09:38:49 -0400 Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2CEBC; Fri, 24 Mar 2023 06:38:45 -0700 (PDT) From: Daniil Dulov To: Mauro Carvalho Chehab CC: Daniil Dulov , , open list , Subject: [PATCH] media: dib7000p: Fix potential division by zero Date: Fri, 24 Mar 2023 06:38:32 -0700 Message-ID: <20230324133832.652630-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.0.20.32] X-ClientProxiedBy: EXCH-2016-02.aladdin.ru (192.168.1.102) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Variable loopdiv can be assigned 0, then it is used as a denominator, without checking it for 0. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 713d54a8bd81 ("[media] DiB7090: add support for the dib7090 based") Signed-off-by: Daniil Dulov --- drivers/media/dvb-frontends/dib7000p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index 55bee50aa871..bea5717907e7 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -497,7 +497,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth prediv = reg_1856 & 0x3f; loopdiv = (reg_1856 >> 6) & 0x3f; - if ((bw != NULL) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) { + if (loopdiv && (bw != NULL) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) { dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio); reg_1856 &= 0xf000; reg_1857 = dib7000p_read_word(state, 1857); -- 2.25.1