Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1090533rwl; Fri, 24 Mar 2023 06:15:26 -0700 (PDT) X-Google-Smtp-Source: AKy350bH2ROdGLEVVxYN7ouDuDZLx0gNewhdvUfHZ+UXHzRlF8flsKISJjeyBjs11gNRmrT9ETzX X-Received: by 2002:a17:90a:312:b0:23f:2d2c:abcc with SMTP id 18-20020a17090a031200b0023f2d2cabccmr2897986pje.9.1679663726698; Fri, 24 Mar 2023 06:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679663726; cv=none; d=google.com; s=arc-20160816; b=KmiQIxjrSWSO1slKnqdfzey8MBemC+tJxMRZoJtM/7+iqjHluANQGCW33jVbejdSGx KxcMJC5BcC0UHtL/YMlb18owdjhFQhjVtEyi3C8RoVH2hwt0jsFMdZw7/FBPki8hJeEG VpOKYPDdVxTU1IIaDC3tlRqyAO3FQvfso5Y/J0x3f5uTqpeYUFC9ZdUvDF9trfRPy4wC M9NzFfBhq2Dgr0ogCq4qZI7z3etpeuID1U9S6gWSxXZZYxvWvNqtWfWRJYoXEvfprHhc EcIE30902m6gFHhWEYcsM4jEkkzTK5cWsxvw8egFBbHFyD7/VqlNQAabRVgshfGecTy6 QgpA== 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=HyYMXIZioFdBq+B0nYTtWBvmYI0+K8xYJQpqJVMyZ113pbepsA6YIWsHm9s3SsKBP9 bmcIWGniQpnQEI2spOQmRDjt46VmUVwSpxKSqivFaGbwChVN7PphHDoiw90dmZVAL5lN VVod8uTLfc2C31Rmc5tbtWuMHpXnwfthDMf30Kg4y/xcLXHlmLwzUgEi3yy0ILK0odJO Y7fKM7KkhK8Uj88WRf2dyPIXVmf0PmsJybiu7y40lRUi4HO2hB7E0wS0keEK9PacWqZo k4V0le0xXpAq4ASozfGaxO2HELhASJZbbt9G1xlqfEah1G6JfSoynbiPqbzrKc94InK4 SJKQ== 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 142-20020a630694000000b004fb838def15si21095428pgg.389.2023.03.24.06.15.03; Fri, 24 Mar 2023 06:15:26 -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 S231150AbjCXNMk (ORCPT + 99 others); Fri, 24 Mar 2023 09:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjCXNMi (ORCPT ); Fri, 24 Mar 2023 09:12:38 -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 82A3995 for ; Fri, 24 Mar 2023 06:12:33 -0700 (PDT) From: Daniil Dulov To: Andrew Lunn CC: Daniil Dulov , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Kurt Kanzenbach , , , Subject: [PATCH] media: dib7000p: Fix potential division by zero Date: Fri, 24 Mar 2023 06:12:09 -0700 Message-ID: <20230324131209.651475-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