From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 9306C314D03; Thu, 22 Jan 2026 14:38:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769092726; cv=none; b=m3xnYnpPrhFKtAO7aKcIuyIYccigoAJqGb4gbUKV2xuadSwKcoHVWS6AG681CVvuWgMKvVdhYKsR4fpk0QQsiz+BTu1FotqdaVtaLOJOgHC5AOGmzfLc6rJgXzhLFHrAwFxqqvWLB5VqeRtYVOKblW2M+qXRqX3BwealrGSN/iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769092726; c=relaxed/simple; bh=KtZZpyl9pEcc1bhKq2hcSBFmtlut5n1uOTpvrtP6wi0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eZmM9BhWkJcwMBFxgu4KhiZs8VXmRSKKn40tuac8FNjeJacpsLTmwNFJakujAFg8mwfFLYJrUOinvBNlrIZkSgUxijLVBgPiMLbiKyQbz2UdevDpLoNRgYFGmTSOwajBTGr+43ysE0pMRDk2jP382uK7dbmgCItE3Pc61wbymc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PToFGCwC; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PToFGCwC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769092724; x=1800628724; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=KtZZpyl9pEcc1bhKq2hcSBFmtlut5n1uOTpvrtP6wi0=; b=PToFGCwC2fq52atNEig3HwX+j3+FWojNNTvNqP7KO0d9oy3uOShOuNCh Bs7BanuPGz6nzUULwOkMCsIYaMZupF0GMePMaSjdsvpmxma3iCzzHcAoq nLjtgQZ+kXhyQYhCNC15YWO3QXt3aeoQBnA/pXaJmdHaX7rr7pH1DtN0C 41uLHmMqh2fKEQGflrx8c2IAXpPQCkYCUjrZWgznjNN36/LaNHJoKlcrB aF2GgToaYuTzkn6tmDe83v7fy+vkVcGAi0y7ojvnSsWYJsZpwr7dW0gl0 pxsfC4ZmIuVF6YkKeokkCibU2pL+L24qKE0ju38g7C6kfIvBMKaJh3WQS Q==; X-CSE-ConnectionGUID: cp+apLRRT9eeZk2vZqibAA== X-CSE-MsgGUID: odLG9keKS1WYuJpR0k8GgQ== X-IronPort-AV: E=McAfee;i="6800,10657,11679"; a="80960995" X-IronPort-AV: E=Sophos;i="6.21,246,1763452800"; d="scan'208";a="80960995" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2026 06:38:43 -0800 X-CSE-ConnectionGUID: 1KXmE5QlREG6g0Q8Cb6ilw== X-CSE-MsgGUID: p0JWiMHeSoq0rGS9N2MNng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,246,1763452800"; d="scan'208";a="211606126" Received: from smoticic-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.225]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2026 06:38:39 -0800 Date: Thu, 22 Jan 2026 16:38:37 +0200 From: Andy Shevchenko To: Vladimir Oltean Cc: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Herve Codina , Mark Brown , Serge Semin , Maxime Chevallier , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, Choong Yong Liang , Jiawen Wu Subject: Re: [PATCH v2 net-next 01/15] net: mdio-regmap: permit working with non-MMIO regmaps Message-ID: References: <20260122105654.105600-1-vladimir.oltean@nxp.com> <20260122105654.105600-2-vladimir.oltean@nxp.com> <20260122121301.cyxyevi7xvqw2axk@skbuf> <20260122134704.pxeikyk4q7nhay55@skbuf> Precedence: bulk X-Mailing-List: netdev@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: <20260122134704.pxeikyk4q7nhay55@skbuf> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Thu, Jan 22, 2026 at 03:47:04PM +0200, Vladimir Oltean wrote: > On Thu, Jan 22, 2026 at 02:13:01PM +0200, Vladimir Oltean wrote: ... > > > > + unsigned int base; > > > > > > Hmm... resource_size_t ? > > Well, regmap_read() takes "unsigned int reg". > > https://elixir.bootlin.com/linux/v6.18.6/source/include/linux/regmap.h#L1297 > > So in practice, a truncation will be done somewhere if the register base > > exceeds unsigned int storage capacity. But I didn't feel that it's worth > > handling that. > > Would this address your feedback? Yes and no. See my remarks below. > diff --git a/drivers/net/mdio/mdio-regmap.c b/drivers/net/mdio/mdio-regmap.c > index 2a0e9c519fa3..416ff4e13e8f 100644 > --- a/drivers/net/mdio/mdio-regmap.c > +++ b/drivers/net/mdio/mdio-regmap.c > @@ -67,8 +67,15 @@ struct mii_bus *devm_mdio_regmap_register(struct device *dev, > mr = mii->priv; > mr->regmap = config->regmap; > mr->valid_addr = config->valid_addr; > - if (config->resource) > + if (config->resource) { Btw, this might be not enough, one should check size and flags as well before use. There was a discussion about this recently. Maybe we should just move to a simple unsigned int in the config for now? Because handling resources maybe considered as over engineering in this case. > + if (config->resource->start > U32_MAX || > + config->resource->end > U32_MAX) { Ideally it should be resource_overlaps() check. But see above. > + dev_err(config->parent, > + "Resource exceeds regmap API addressing possibilities\n"); > + return ERR_PTR(-EINVAL); > + } > mr->base = config->resource->start; > + } -- With Best Regards, Andy Shevchenko