Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5406267rdb; Wed, 13 Dec 2023 07:50:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+h3kZu8428YKuPGwDY+cDWMRynqj5+kF0WcYmFkcXZLo7WjGYVPgd79V78SDNN32BniGw X-Received: by 2002:a05:6a00:4653:b0:6bd:f224:c79e with SMTP id kp19-20020a056a00465300b006bdf224c79emr5031132pfb.11.1702482646042; Wed, 13 Dec 2023 07:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702482646; cv=none; d=google.com; s=arc-20160816; b=wI5Tc5U+N9VsRrMWeFY019KBeZNdZ2c6DAMqQaorhJy65j/z7FXcAUi4UwjXukb9k9 Wixzpb0WQua37qQ77OLfjeu8BjO7XQWIdJKBU82KfiR+2KUlK5oZqQztSqEAlOLM/2ix b3+QmXqag7ovr7/6Q+O1WG0YHM/mq4bKPnXHulPC1phIXzgscHSIfcRwyueM8VYo0ZTQ 0NO/pYBBfTNvoJ2Ls2ZKRK7pVq5vAspbT5r7Az7dlZ4bkfZ0fCLiQz2esOz3uu4uieco bvZHOlzYoXp/uvUauMjn8X2+QclaQqftuS/gU10MVTo/PkP/TTm80qw68sRIPaVijo4i RM+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:subject:cc:to:from:date:message-id:dkim-signature; bh=dOakPEBgPAHiEGOD9TL6ZF5Zc40kCskBgDb8Dym+yf4=; fh=KSnBNzz6CO+h7tzGMj9lgb1e+5CZD95KyIXuWnaEN2s=; b=EEdphwlkXfbitIAJJbVvmA319uIeAeHt+dc899jv/PfmVCMpf2Myj2UZujKz3+aP8j gmZo7wmLKOqgkmNmSu8FKfvcik7LE5lN34Obsb+b0kXUvshrovyUNuxFKqAsd125zzam ZLACKkRhY8Eg4ueVi+2i82wzqVI220dwggxyOHyfZmDvUIWvHcOHrEaXmhDFYBMNISQK eg9AoONtRCynVoUH1jZMAQvV3nEuhDEgVo2Vu6c8cXvAnjOBPWVjpXDnrgkBVMw+iBt5 +af9WTmASQ05zG4Kxd7tJyZMRaJ6duN8KogYLgjtHXBizOzRdcSykN9Umnhbow7GZwDo /W8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=H2i54W6v; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x20-20020a631714000000b0057e21f51ab3si9608147pgl.665.2023.12.13.07.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:50:46 -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=pass header.i=@gmail.com header.s=20230601 header.b=H2i54W6v; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A57CD806885A; Wed, 13 Dec 2023 07:50:44 -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 S1442208AbjLMPue (ORCPT + 99 others); Wed, 13 Dec 2023 10:50:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442173AbjLMPuc (ORCPT ); Wed, 13 Dec 2023 10:50:32 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9442AC; Wed, 13 Dec 2023 07:50:38 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50bfa7f7093so9155897e87.0; Wed, 13 Dec 2023 07:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702482637; x=1703087437; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=dOakPEBgPAHiEGOD9TL6ZF5Zc40kCskBgDb8Dym+yf4=; b=H2i54W6vFufuYo0HrUXW1b9bxvEQrJ5upMhwn8E2SoL3ujZuqO1EXU484FUQgbR9rr ofnKBtrwVn9BhsRD1RZazyTxajkpKI1GZ/hf+bGkv+67HPjCq6FBZWIYvwke382low4h LRcVajc2BmYijXOiu7hUuTq8cjHVhrwhZKihZF37XIEvYLCY1hxdlJVQ0KIKywkunJVG oSWM+kVN6wOXHZs8REnxd0OHRWnHb4XQiMvhrl67O4kZz+At56IV/AmPdyFE20mPNADP St1GWdzLSB6PAuwf/c0H1iPIhfLNPg4Nv7oINo6kQBAXssj3GW4g0OwsQoK4194AWeOk L+uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702482637; x=1703087437; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dOakPEBgPAHiEGOD9TL6ZF5Zc40kCskBgDb8Dym+yf4=; b=aHItIGalCPc30IYEtcUFN0vMosl4kZawlbqJNNZdpuZ96vMGL0TPS9xyvSb/HegXcl kVzmKPmDVBylJk6Mc+nPPAkX99CQfEplivn3XlO5yrcjdbvDx85cz8ZfKqtKeSnhijeU c+Z0R+giSXyV7CNAEWtd5O0H43R5vFtHbtqKYCOCREChjDGhg2GhI3sy72LsxpSQTDRL tY9g324NErGv/QrGnchnAr68csye+wOhAR6+F00TlhxXlDi1YM4ojYhVCVzuIDldnvGv wN3emYHSMJ7sLDuvn4j0JXVzZlbpfgZn3z9w6HseUmBo9VCFRfXQLTpM4dKYrf2M8gQI g6vQ== X-Gm-Message-State: AOJu0YyfKIMsCail8gfuSNTfSZWghFGwvgW/4O6zI+fNfdXP2dDki7ka XYRvdKn0vtI39rD+zV7A5Kw= X-Received: by 2002:a2e:bcc9:0:b0:2cc:2af3:5edb with SMTP id z9-20020a2ebcc9000000b002cc2af35edbmr2510066ljp.14.1702482636607; Wed, 13 Dec 2023 07:50:36 -0800 (PST) Received: from Ansuel-xps. (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.gmail.com with ESMTPSA id v6-20020a05600c444600b0040c46ba7b66sm12056425wmn.48.2023.12.13.07.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:50:36 -0800 (PST) Message-ID: <6579d2cc.050a0220.e6ea.d8cf@mx.google.com> X-Google-Original-Message-ID: Date: Wed, 13 Dec 2023 16:50:33 +0100 From: Christian Marangi To: "Russell King (Oracle)" 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 References: <20231213105730.1731-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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:50:44 -0800 (PST) On Wed, Dec 13, 2023 at 03:45:24PM +0000, Russell King (Oracle) wrote: > 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. > Maybe I'm confused but isn't already like that? On phy_package_join base_addr is already checked if it's negative (and rejected) addr_offset is unsigned so it can't be negative. We can switch addr to unsigned just for the sake of it but if I'm not wrong all the sanity check are already done. -- Ansuel