Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6269484rwp; Mon, 17 Jul 2023 19:04:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkd1YfB+2cUOPr3HZ4j3+RtSk08FHlMfqaPYfGVtYDgo8wiMaGAL089ZP7Ht3X81JRN4UC X-Received: by 2002:a17:90b:4b4a:b0:262:e564:3ecb with SMTP id mi10-20020a17090b4b4a00b00262e5643ecbmr595414pjb.36.1689645893267; Mon, 17 Jul 2023 19:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689645893; cv=none; d=google.com; s=arc-20160816; b=MvrzNW2ibmpdC1XSVIdANAY6qakcy3dsbGXJMuJbwtSn4tv1uQsC2cDkn0PGSAal5e JoK+91Jb/BzdD491py6aFKh8auWBQYAuLgW+wG8JqQRU0xxYqvvubE2K7rux6K1YtPd6 MTsl2XebGejjkN7KEn/+4nWZPFE6u0ZQNyq8fav+sTx4fJGBLsAQbbrzb1B56As8MEor q0c/GYgST+IsqsFLb1b5dylgNpizdMTD08wq2MQvYMYKtUNSf11BTZ7VQ6GCiy6/TwZt pAFb1RiNJBp6xjeBiDQIGWwcXqyHmEQ396J297EXay27kubBT23g3D4UJ9DeLHshdVWW fhoQ== 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=JNfPXesweDzoChT7ErCmeczX+0hW7/j0w+CsfXD241U=; fh=h3dfEwrecYRL/L7UyMoDrhcMK0tB0EDw9ek5E2BJVOU=; b=fvWjIFK5ZcNL3bliJO5o6wGeQEnDLlYQTeweG/36kKsTu1aIRPrX+F+fi/hYSWY/ku KrHnGPQyX/BJvQCZxAd7rg/Q0gVc5i6s50kjmIjZzeZEXKdYwwLUbF7OmCfKsb7hGde7 m7msLVHkFvgt/PDDxX7Sw0ixXKzWUSVectEUw11tHsXePg3ZyB7mH9l6Tc8xBbByMu3q kgya9D5jiukQxdQRFxzq2GV0Z06Io357M9XppufODBXVjdTM+pTLsd1HhEgDtHDgujy4 bbFRxZzzDMRgwDC2IvDhh+Y4g1c/HYs11cx+Coe07sYWkxjZN7owOVOstBok+2MUReAA 4nYQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a6566c6000000b005533c53f577si750832pgw.138.2023.07.17.19.04.39; Mon, 17 Jul 2023 19:04:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbjGRBdH (ORCPT + 99 others); Mon, 17 Jul 2023 21:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjGRBdG (ORCPT ); Mon, 17 Jul 2023 21:33:06 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 0AF8A19F; Mon, 17 Jul 2023 18:33:04 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 840BF608631F4; Tue, 18 Jul 2023 09:33:01 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com, airlied@gmail.com, daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com, andrzej.hajda@intel.com Cc: ville.syrjala@linux.intel.com, lyude@redhat.com, mripard@kernel.org, suhui@nfschina.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH v2] drm/i915/tv: avoid possible division by zero Date: Tue, 18 Jul 2023 09:32:17 +0800 Message-Id: <20230718013216.495830-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Clang warning: drivers/gpu/drm/i915/display/intel_tv.c: line 991, column 22 Division by zero. Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1, then division by zero will happen. Fixes: 1bba5543e4fe ("drm/i915: Fix TV encoder clock computation") Signed-off-by: Su Hui --- drivers/gpu/drm/i915/display/intel_tv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c index 36b479b46b60..f59553f7c132 100644 --- a/drivers/gpu/drm/i915/display/intel_tv.c +++ b/drivers/gpu/drm/i915/display/intel_tv.c @@ -988,7 +988,7 @@ intel_tv_mode_to_mode(struct drm_display_mode *mode, const struct tv_mode *tv_mode, int clock) { - mode->clock = clock / (tv_mode->oversample >> !tv_mode->progressive); + mode->clock = clock / tv_mode->oversample << !tv_mode->progressive; /* * tv_mode horizontal timings: -- 2.30.2