Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2763370rdg; Mon, 16 Oct 2023 14:16:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFODhWnoK15svZK5BfGkjWVpvNm+86glU+vFas5I/pKgz4C5kplfP4dzwFWdoUbRIzmbE9u X-Received: by 2002:a05:6870:9a21:b0:1d5:8fb8:98ef with SMTP id fo33-20020a0568709a2100b001d58fb898efmr342787oab.31.1697490963995; Mon, 16 Oct 2023 14:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697490963; cv=none; d=google.com; s=arc-20160816; b=hKgFr5wNIOO/8bCwJpWFZvSt9Vfp6zPP0VlcEXia2sBe3QMl+0fzpPlHbOLm2Y9o9U MazKcLGbS9/pdzzJnOChUnbahzD2n/ZY7AlHCb3vZm/+yBj2ZFDPsrTYB0+m/2WrYAVo ZQQiN475Fe2c4MR/55VKmlm9pVnw6dfl61/31LQef7AgXFDAT8yy8EZNK5aPymnJMCDz BE589sv5BNFFO9kt2oAZGcZwAlCHDIBa4Svuger4Qx0NXcXaG84fpt0pTxbG0n55JzjP eYvgXpieVZ2KNiOdQdFbPKag63Jf2z+MlXb7bbxAO17u+ExYPoZJsHl3PBop3YPztcH0 1b7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=t1O5Pi9qDYRl5AQTrWhQeyyB+7dGNGZhP9fc5Gl71KI=; fh=4RBpDtWKPvEPafnT1RvJn5gAjpen/lkPNvUzy1wF0Wc=; b=AtS9z448aQzYezINa21FOk5NKKC/5fijken8jZ7n+bJdsznwdWqvro9Y3D17+hbr+S 4f3imuOUwv/OHePuA0Sf7mLqeVLHx3p3QAtQ4y6+jhd1W+rbvdM5irNq27Ny6JwqH9AF UiHUSedKQ6tehrKaa1hMbmRIl2P9uOsYiGXXtsi5hTlK3Hl/ekv/edLOYmUVB1NdGtfk c/XF/KpvZ+7DuqqgpZ0CqQK4kxNSDzMYxySTqukDx2e+GLUN6QfC1sFmyMycEZWQPZPt X4daQSBdVq+h6tmuLOwl6k2F4KBnoEnYJiMi5IpXClS9k/4DQ3TKJSxnxn2O/tQhdXJh GIqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=Utk79TX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id o20-20020a656a54000000b00578e5228c76si181700pgu.505.2023.10.16.14.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 14:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=Utk79TX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 312AA806AFFA; Mon, 16 Oct 2023 14:15:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231221AbjJPVPn (ORCPT + 99 others); Mon, 16 Oct 2023 17:15:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbjJPVPl (ORCPT ); Mon, 16 Oct 2023 17:15:41 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0733A2; Mon, 16 Oct 2023 14:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1697490929; x=1698095729; i=deller@gmx.de; bh=qt5SCacwR+qzi/Vd+l+sCphO9tmMZL/NjDwuWp8B9YM=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=Utk79TX2JS5EkQy03SN5tA37tS5cg5CNpwosz/HhQ9BuHyot7bW/uWyNrVcaoGNicqJ9SERC9uN shXLjR+ocgg2yEQ9g0kaoblm660N17vuoQjCQEesEljRAz8mgH38256Jv8QZ2Ae3hKq3aDz+V+Rh0 hGmLMlkBjOMA8E3NXWrpIgWtrx54eDa8XSzgmayKBryZ5NLVWN37S0mBL0WJVEKFloJ7NbCzWf5Jc QSch7l7n3dknCwPdixvzpLZRnQJFzlNZYP/2nRnEHFCqK0iHxZ1tqcDBkxsOFO2ksY/R6CPhW69wv 9mGvSl/ZccVkJMGuguOay/wPkO9i76XJ18mA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.60] ([94.134.153.197]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MUXpK-1r1KbZ0uxs-00QWzk; Mon, 16 Oct 2023 23:15:29 +0200 Message-ID: <34994a3f-e44d-4ef1-95ee-2b2a885b3732@gmx.de> Date: Mon, 16 Oct 2023 23:15:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fbdev: fbmon: fix potential divide error in fb_validate_mode Content-Language: en-US To: Zhang Shurong , daniel@ffwll.ch Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: From: Helge Deller Autocrypt: addr=deller@gmx.de; keydata= xsFNBF3Ia3MBEAD3nmWzMgQByYAWnb9cNqspnkb2GLVKzhoH2QD4eRpyDLA/3smlClbeKkWT HLnjgkbPFDmcmCz5V0Wv1mKYRClAHPCIBIJgyICqqUZo2qGmKstUx3pFAiztlXBANpRECgwJ r+8w6mkccOM9GhoPU0vMaD/UVJcJQzvrxVHO8EHS36aUkjKd6cOpdVbCt3qx8cEhCmaFEO6u CL+k5AZQoABbFQEBocZE1/lSYzaHkcHrjn4cQjc3CffXnUVYwlo8EYOtAHgMDC39s9a7S90L 69l6G73lYBD/Br5lnDPlG6dKfGFZZpQ1h8/x+Qz366Ojfq9MuuRJg7ZQpe6foiOtqwKym/zV dVvSdOOc5sHSpfwu5+BVAAyBd6hw4NddlAQUjHSRs3zJ9OfrEx2d3mIfXZ7+pMhZ7qX0Axlq Lq+B5cfLpzkPAgKn11tfXFxP+hcPHIts0bnDz4EEp+HraW+oRCH2m57Y9zhcJTOJaLw4YpTY GRUlF076vZ2Hz/xMEvIJddRGId7UXZgH9a32NDf+BUjWEZvFt1wFSW1r7zb7oGCwZMy2LI/G aHQv/N0NeFMd28z+deyxd0k1CGefHJuJcOJDVtcE1rGQ43aDhWSpXvXKDj42vFD2We6uIo9D 1VNre2+uAxFzqqf026H6cH8hin9Vnx7p3uq3Dka/Y/qmRFnKVQARAQABzRxIZWxnZSBEZWxs ZXIgPGRlbGxlckBnbXguZGU+wsGRBBMBCAA7AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA FiEERUSCKCzZENvvPSX4Pl89BKeiRgMFAl3J1zsCGQEACgkQPl89BKeiRgNK7xAAg6kJTPje uBm9PJTUxXaoaLJFXbYdSPfXhqX/BI9Xi2VzhwC2nSmizdFbeobQBTtRIz5LPhjk95t11q0s uP5htzNISPpwxiYZGKrNnXfcPlziI2bUtlz4ke34cLK6MIl1kbS0/kJ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7xTEZATRfc47Yc+cyKcXG034tNEAc xZNTR1kMi9njdxc1wzM9T6pspTtA0vuD3ee94Dg+nDrH1As24uwfFLguiILPzpl0kLaPYYgB wumlL2nGcB6RVRRFMiAS5uOTEk+sJ/tRiQwO3K8vmaECaNJRfJC7weH+jww1Dzo0f1TP6rUa fTBRABEBAAHCwXYEGAEIACAWIQRFRIIoLNkQ2+89Jfg+Xz0Ep6JGAwUCXchrcwIbDAAKCRA+ Xz0Ep6JGAxtdEAC54NQMBwjUNqBNCMsh6WrwQwbg9tkJw718QHPw43gKFSxFIYzdBzD/YMPH l+2fFiefvmI4uNDjlyCITGSM+T6b8cA7YAKvZhzJyJSS7pRzsIKGjhk7zADL1+PJei9p9idy RbmFKo0dAL+ac0t/EZULHGPuIiavWLgwYLVoUEBwz86ZtEtVmDmEsj8ryWw75ZIarNDhV74s BdM2ffUJk3+vWe25BPcJiaZkTuFt+xt2CdbvpZv3IPrEkp9GAKof2hHdFCRKMtgxBo8Kao6p Ws/Vv68FusAi94ySuZT3fp1xGWWf5+1jX4ylC//w0Rj85QihTpA2MylORUNFvH0MRJx4mlFk XN6G+5jIIJhG46LUucQ28+VyEDNcGL3tarnkw8ngEhAbnvMJ2RTx8vGh7PssKaGzAUmNNZiG MB4mPKqvDZ02j1wp7vthQcOEg08z1+XHXb8ZZKST7yTVa5P89JymGE8CBGdQaAXnqYK3/yWf FwRDcGV6nxanxZGKEkSHHOm8jHwvQWvPP73pvuPBEPtKGLzbgd7OOcGZWtq2hNC6cRtsRdDx 4TAGMCz4j238m+2mdbdhRh3iBnWT5yPFfnv/2IjFAk+sdix1Mrr+LIDF++kiekeq0yUpDdc4 ExBy2xf6dd+tuFFBp3/VDN4U0UfG4QJ2fg19zE5Z8dS4jGIbLg== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CQ+YnTw6KdXAZpnpWmEclIUl/ZNN5/eRCNxAwN1Cz4SIGQdfZ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/eNoYTrwVj+X8KFjoE4O0pAhxjftOXqBi4zQeBQzN7BP3d3NqtubKaYAOT 2NpMm7ulGDaYw4BSQDevcKjoJ+IPlRC9DmcR38+FyH2pXT15xM/JtWllRWi6/6j0Lqp7tZEHb cOx1Rxm5sW/WthFQn/yVvg55NI4= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 14:15:52 -0700 (PDT) On 10/14/23 14:14, Zhang Shurong wrote: > We can easily use FBIOPUT_VSCREENINFO set fb_var_screeninfo, so > it's possible for a divide by zero error to occur. > > Fix this by making sure the divisor is non-zero before the computation. > > Signed-off-by: Zhang Shurong > --- > drivers/video/fbdev/core/fbmon.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core= /fbmon.c > index 79e5bfbdd34c..bdd15b8e3a71 100644 > --- a/drivers/video/fbdev/core/fbmon.c > +++ b/drivers/video/fbdev/core/fbmon.c > @@ -1470,6 +1470,9 @@ int fb_validate_mode(const struct fb_var_screeninf= o *var, struct fb_info *info) > if (var->vmode & FB_VMODE_DOUBLE) > vtotal *=3D 2; > > + if (!htotal || !vtotal) > + return -EINVAL; This is above here: htotal =3D var->xres + var->right_margin + var->hsync_len + var->left_margin; vtotal =3D var->yres + var->lower_margin + var->vsync_len + var->upper_margin; I don't see how htotal and vtotal can become zero... Helge