Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5404152rdb; Wed, 13 Dec 2023 07:47:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyOhs4JKvQTeVBNHlgthptTpfWuQReqiAVvi5tSJ9L70taWwL4R2S8jYTViZCpYGx2S0Nm X-Received: by 2002:a17:90a:e2d1:b0:28a:b6ed:d479 with SMTP id fr17-20020a17090ae2d100b0028ab6edd479mr1715493pjb.45.1702482420592; Wed, 13 Dec 2023 07:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702482420; cv=none; d=google.com; s=arc-20160816; b=wW4MsBodmUjD81JJ7gVI5msbgTzmVaIrjwFmIVhqSo/4O2wLwVmXbFZrnooxSzho96 vAacfU+dE6zPmr5XoR0rxzr9d4qhCDeEcnmsoE/Fwck4XX3EzRqs7aKEWB2TiH6XnFS2 Aku/m89JIDfoCJQNFjs+wo51xc6oAswwvHnVEUzhn5JqKcTGvviwpoYgm8kBmycUEXhp qCiV51/k5Ox5q4YJPj+0khkxct0NoaF/YoKQO1huq3uV8Vup+M1/YGvW1RDqpqpkZOnE EJKX1rUpqP0hY8Znww8KenGDyItN8LEIGLMd4s0xZSYEMeJM4eblZxbxw5J9bpUi6G5s XB6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RQ3wc5JxvIn7TWgkZzitesTubhuMcown2Fe6VgEWQMw=; fh=ZUIGhA6eww0lpdXy5u6KSD0KEo5uW3E3cR6Ghf4MiIE=; b=goD+ZO4dSbhWE1n2ckg2N8mhdmcuHr8lagzqbMkk5szMtvLUdixfzQ8I7AMf4XKBmE GxBwuFyXcxXa6m+bRRV0OdJBZcPYZpgrV1vGUppuXAeAbH9FCllXjhouwBeNRb34rF5G WKp5oJIvsFSAaMLq9okRI4yqgK0yGy4pxpGDfurMbnxAXwnZjkLeHXqaSgaRXlT7bqot mFt2TZUZ2GP2UYmaQA/MZKTkg4YOc+4Q2G7F+lUHQ03wd3mhHtGTaNFqtinNRrgpkmWQ a+KCdwjbzYkCYUFJ3kQN9ZWkcKLvgJZi+kxRgVciraYKYk2TuCUPW5ixJtGXNdRdBBZ3 hXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=RC1f7nvb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q7-20020a17090a68c700b002886a242d11si9834333pjj.130.2023.12.13.07.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:47:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=RC1f7nvb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CEF0E8090FB3; Wed, 13 Dec 2023 07:46:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442399AbjLMPqE (ORCPT + 99 others); Wed, 13 Dec 2023 10:46:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442596AbjLMPpp (ORCPT ); Wed, 13 Dec 2023 10:45:45 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8332D4C; Wed, 13 Dec 2023 07:45:32 -0800 (PST) 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=RQ3wc5JxvIn7TWgkZzitesTubhuMcown2Fe6VgEWQMw=; b=RC1f7nvb1Lmp4iGlF8Dymy6bZy yzZVqCnYhYW44/PO7iRvfAAXnYnUJUfhOdZ3dxN05qbyLlP27DZIISio6Snx0BRIxLUbDqA9uTrbB bz7OP2HHlOI2c+5jkDNnlKt/rFGXkFN7dwhvo+ZfawF0506SNKGwWNnwE043hhanTQRXO7CzUWTFg KoZtq1O9ktg3gCp4xjn5oCebYP6Ye74iyHsBeEHndOhq+iODJM5o1wdBIgOQALrpcmk8z72ARMkPn LG1sYsTAvIOG4TpFOd9wTAsgjvkdWYVuMraPpluEHw5Rkwk75hySrJzuJwMJrsP5rsjSn3OHUgMUL PyX5xZqg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:53372) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDRQI-0000B1-2n; Wed, 13 Dec 2023 15:45:22 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDRQK-0001cW-HO; Wed, 13 Dec 2023 15:45:24 +0000 Date: Wed, 13 Dec 2023 15:45:24 +0000 From: "Russell King (Oracle)" To: Christian Marangi Cc: Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , David Epping , Harini Katakam , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [net-next PATCH v6 1/3] net: phy: extend PHY package API to support multiple global address Message-ID: References: <20231213105730.1731-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231213105730.1731-1-ansuelsmth@gmail.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:46:19 -0800 (PST) On Wed, Dec 13, 2023 at 11:57:28AM +0100, Christian Marangi wrote: > -static inline int phy_package_read(struct phy_device *phydev, u32 regnum) > +static inline int phy_package_read(struct phy_device *phydev, > + unsigned int addr_offset, u32 regnum) > { > struct phy_package_shared *shared = phydev->shared; > + int addr = shared->base_addr + addr_offset; > > - if (!shared) > + if (addr >= PHY_MAX_ADDR) > return -EIO; If we're going to check the address, I think we should check it properly, which means also checking whether it's become negative. Alternatively, we could consider making "addr" and "base_addr" unsigned types, since they should never be negative. However, that probably should be done as a separate patch before this one. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!