Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1215653lql; Tue, 12 Mar 2024 10:19:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6tkAJ2K9icYvU7CMIGIvWaxDHN0T8rW7VQGhY/E63eNLSAmkOCQ/ZkOeyNfKCEHoS6EfgkgbkA2OM5VwoiETNmy7zXuG9RwlUn04yaA== X-Google-Smtp-Source: AGHT+IFMRrfGFACcAM67nswv0QtHUIc6jGNou95mrRnbjhBoNoXMEkbeNLzfLWmWL79/V8vVEcsd X-Received: by 2002:a17:903:32c4:b0:1dd:998f:f21d with SMTP id i4-20020a17090332c400b001dd998ff21dmr8299817plr.22.1710263957315; Tue, 12 Mar 2024 10:19:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710263957; cv=pass; d=google.com; s=arc-20160816; b=BBsWFLBUDw1Ybw9u1bDtM1/Phrc3HUzmNj1uCjylASlKLFEpmtfUrcUeuYEW6Jxlqh Q7LRsfvDxYEPnJFyJ8QIpNPu1ZgeGPthW6GQgV8pojFaOxUp6yWsqJKUXfgw9Qv+go0E E2VG2zVTbp6OEwu/BlGb7PoHetILJy74xe8qNHpBHlZdEdvmLN+oZQETw5VUBX5vlJ1/ YlWrF6nBGycK9bdL3qnioB0SO7iZQHKYOgmld+jZlf1tS3NbTvoF4O3fY3yTW2Nj97Vo wScMxLW8o0OAdHPUuQ7owOL85qQ7Hfk1bc40KGgWyN+qzTp39hj2kE44KzlKAJY3VGY+ Vr8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=Q3wlt+VAJLwYZMvvvsupUuGC/FaDNVJETwt8qAhUif0=; fh=/Wx2G7MSxR2VCzmTIh7/ggA+oufWrycI6YVt+Uq6+O0=; b=mF0uMulUwOjQwPlJ6SOo/UCQqx06BMLBFr4DRERY9W5h4prOQp8j+xKlHkd6RYyFAy cBGYyDTWLnkLzE7gZvZ0RHEueBRJsPYL1NZTGwXAuUhFZbQEOiARZTSmhJXSd6DezOu0 DU9+JbzMCwVU4uuFkYQLHMKZemcNbBYi6wVOblwfZrls7grwpryv72tXBcrLg17scskU Vmi0syqw0HDYWanHkBYJv2wX4Gw8oC2pofyCRbpJCKQtQMkqI2EfUxmr9hlG9L4nbHsp nFUwUz6HTv4Fj9mg7/5HbE9ZI28O2HxzP2n1DBHtpz2fAdz6R20reWVA72ir9LllIdyB yBWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Z0vu9EUV; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-100590-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k18-20020a170902c41200b001ddb010831csi2703971plk.389.2024.03.12.10.19.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100590-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Z0vu9EUV; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-100590-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F0419282087 for ; Tue, 12 Mar 2024 17:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA0CC1384AC; Tue, 12 Mar 2024 17:19:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Z0vu9EUV" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D980137C5A; Tue, 12 Mar 2024 17:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710263945; cv=none; b=MqegrwEHXlmJAEXZao0hCz2GSPBw+zBWlhNrelDc4cSizGrnW00+LBuoJ912WGqWYxeQh9/NYEtAaKf7UYuQhNjI/faNrdq2ijppsEBJcJfgkSNtsvR4USareQ5/blS57aDVzG4A1X7VgmsulUCksHrliPT+yS2WsePu3A8OXQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710263945; c=relaxed/simple; bh=bp3DPapmLXS9Ig/m12t4o90H2TRiUcDtfkduFK1MMjQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b2c+yKwkO8M0bIiNxR1Yt32sxBsisHbfJ+jL3/k287WRPBSKXff0RpoxKStMfQm4LvWFAddIIkzUk+5/10I7yEncNjX0Opz5bgz9eLhYs7r//XmICujg2DJ40a/Gbha/BqhvGe15TNe7uSRmu712yFIIJknuyWxBXfyUzaTCa08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=Z0vu9EUV; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q3wlt+VAJLwYZMvvvsupUuGC/FaDNVJETwt8qAhUif0=; b=Z0vu9EUV9RylD3PZqkvmkGc6jL dRHDaikwOZFuJ0VTPDAKAhUf7XFq9KEx0NijUIbcR02TiC09ZxWGR0xG+g9Tj8Tuz0rBAvwONr9/r N+eFNQ5fbE+pOH5srUiYscLkIaiZYmIqbom5Xb+sT3Xzlm5ZsgFPrgdUxrkc9w/csuRloepqZLo/D p+gbaZfy7gIctkJTm6uD45I+FZCItWiekuK6sxy1bC2PR13yuamBbaDjYzjkaFPnK3Ox4bnU4fxlk 8Voz3DRCYpF1i7TdpXpvlR3JVU6CPZVQv6sQCN0utzq4g9RpW4j51RsYQ9Lzo3A50XNJweFxrGjpB j+efElHA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:55750) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rk5lz-0006mM-25; Tue, 12 Mar 2024 17:18:43 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rk5lv-0003ih-Ue; Tue, 12 Mar 2024 17:18:39 +0000 Date: Tue, 12 Mar 2024 17:18:39 +0000 From: "Russell King (Oracle)" To: Daniil Dulov Cc: Jakub Kicinski , Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Doug Berger , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH net-next] net: phy: mdio-bcm-unimac: Cast denominator to unsigned long to avoid overflow Message-ID: References: <20240312165358.7712-1-d.dulov@aladdin.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240312165358.7712-1-d.dulov@aladdin.ru> Sender: Russell King (Oracle) On Tue, Mar 12, 2024 at 07:53:58PM +0300, Daniil Dulov wrote: > The expression priv->clk_freq * 2 can lead to overflow that will cause > a division by zero. So, let's cast it to unsigned long to avoid it. How does casting this help? "unsigned long" can still be 32-bit. Maybe unimac_mdio_probe() should be validating the value it read from DT won't overflow? I suspect that a value of 2.1GHz is way too large for this property in any case. https://en.wikipedia.org/wiki/Management_Data_Input/Output#Electrical_specification (note, this driver is clause-22 only.) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!