Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp723927pxu; Fri, 23 Oct 2020 11:39:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoodYnj2eIUCmxg6S11eGo4ltIKBvkhdJKN566AYS6rYqjOLKoMbXA70AFUmJ4XPUJeN3K X-Received: by 2002:a17:906:118f:: with SMTP id n15mr3504724eja.394.1603478376246; Fri, 23 Oct 2020 11:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603478376; cv=none; d=google.com; s=arc-20160816; b=eweT73A+XktaFkScN/OQMhFhnwQTbgVhk5WXq1yU8kw/vbx8oni+wM2kysQXqVaLrX eg9YG3Nv4h1Z/K2sLI0nQO8nqd6Kj5XXLrZtQNKKnwlFcqUSfxPVRk9qHK8ziS8Jd04K vgUz/KHt9mzg9Bj+K7RQw8S1II09Ia/yHKscWfJyACRtlTcSBTS4/HXbLWcJc+iFvJWy g2EvxgbDWDztAOX0Ux3sy1IhWl14J0XZuPZbh506BOHSQJX2+c6+W29wjQrtznnWohcg TrR3utWwz1v8XYS/9W/SBdnRPeRbA7UxONHFn//Ip+is/0t43PaGaNsO4pIOgOuPTRAP PdpA== 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 :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=fpfmanFgqlU/lzWtOZ6sJt9HDyNApPI+OcMiQ1jU2Q8=; b=pGNs61i7EG2s3keP1XMnrmEyN/rDkgSGK5f/4EnkR+9l62SNHdg9w7ZU1Gm9bsDRZB ygmgv69LhFoFyLd2vBqYpf9pwT1fGt/8YSaTPFcYFB4DUgzP1kpSZG7+8NQGZQFarLjh GvdnA24UuARyyM/8RdUA8YAZfOo4tQFHWWsSmZec8ebdBxA0QTELeu4vQ7FY536lMsbN 6Io199Wxlwb4+pljFIT/n9iXN0irD5CyWS6AgPQ+lxOGCV801Sl5vbXIJDXOTgiTdohq oSxgynkg/biK9/Nvfinq/K/AH1iNzz/aqdAUPllULpLHBwblJCfL+JvM0CF3fPw5sKE9 51Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=kIDxE14Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si1251300edr.199.2020.10.23.11.39.13; Fri, 23 Oct 2020 11:39:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=kIDxE14Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S465635AbgJWPOd (ORCPT + 99 others); Fri, 23 Oct 2020 11:14:33 -0400 Received: from mail-03.mail-europe.com ([91.134.188.129]:40414 "EHLO mail-03.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S461690AbgJWPOd (ORCPT ); Fri, 23 Oct 2020 11:14:33 -0400 Date: Fri, 23 Oct 2020 15:14:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1603466069; bh=fpfmanFgqlU/lzWtOZ6sJt9HDyNApPI+OcMiQ1jU2Q8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=kIDxE14QEkaab3DTVkhGSAm0Ss7xK3j7CsyJ5mOtzoqIfPmmgCVWRXnbm297kmrD/ CjHX777iIfuy6oMkDbm+0N6W9LN9V/fN44t4vjKaXngxyNZUeMmMgkjEq+r3LsT4+K bD3IR6FMLBYLV3rk7NKQ1IV9p+OxJYhiWmWXTSqwJlCavw9Kctkxy4+VE9zYCmQ4h0 bHaPNdqcAQR5/hqMcYr5N0CcB5k22sLWqvDqdKFIa4xdF3AnRlKIi8AUkFM83RPo6i UYzNlD5ezvMF79e099tP36ZH4tm8xIkRSVXtj1JGc+S7QBtMyoJh8Z7q1iwzLr9ki1 VOeAxdvce0hSA== To: =?utf-8?Q?Ville_Syrj=C3=A4l=C3=A4?= From: Simon Ser Cc: Randy Dunlap , David Airlie , intel-gfx , LKML , dri-devel , Pekka Paalanen Reply-To: Simon Ser Subject: Re: [Intel-gfx] drm_modes: signed integer overflow Message-ID: In-Reply-To: <20201022101423.GI6112@intel.com> References: <47527cdb-2eda-b5a3-d77c-3855b91a0b61@infradead.org> <20201022101423.GI6112@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, October 22, 2020 12:14 PM, Ville Syrj=C3=A4l=C3=A4 wrote: > On Wed, Oct 21, 2020 at 08:13:43PM -0700, Randy Dunlap wrote: > > > Hi, > > With linux-next 20201021, when booting up, I am seeing this: > > [ 0.560896] UBSAN: signed-integer-overflow in ../drivers/gpu/drm/drm_mo= des.c:765:20 > > [ 0.560903] 2376000 * 1000 cannot be represented in type 'int' > > Dang. Didn't realize these new crazy >8k modes have dotclocks reaching > almost 6 GHz, which would overflow even u32. I guess we'll switch to > 64bit maths. Now I wonder how many other places can hit this overflow > in practice... Can you provide an example of a full crazy >8k mode? I'm trying to get a fix for my user-space [1], and I'm wondering if int32_t is enough after dividing by mode->htotal. CC Pekka, just FYI (I think Weston has similar code). [1]: https://github.com/swaywm/wlroots/pull/2450