netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function
@ 2024-03-20 14:19 Claus Hansen Ries
  2024-03-20 15:22 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Claus Hansen Ries @ 2024-03-20 14:19 UTC (permalink / raw)
  To: netdev@vger.kernel.org, Simon Horman
  Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, michal.simek@amd.com, wei.fang@nxp.com,
	yangyingliang@huawei.com, robh@kernel.org, harini.katakam@amd.com,
	dan.carpenter@linaro.org, u.kleine-koenig@pengutronix.de,
	wanghai38@huawei.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

From: Claus Hansen Ries <chr@terma.com>

Hope I am resubmitting this correctly, I've fixed the issues in 
the original submission.

platform_get_resource was replaced with devm_platform_ioremap_resource_byname 
and is called using 0 as name. This eventually ends up in platform_get_resource_byname
in the call stack, where it causes a null pointer in strcmp.

	if (type == resource_type(r) && !strcmp(r->name, name))

It should have been replaced with devm_platform_ioremap_resource.

Fixes: bd69058f50d5 ("net: ll_temac: Use devm_platform_ioremap_resource_byname()")
Signed-off-by: Claus Hansen Ries <chr@terma.com>
Cc: stable@vger.kernel.org
---
v2:
  - fix accidently converting tabs to spaces and wording in commit message
v1: https://marc.info/?l=linux-netdev&m=171087828129633&w=2

 drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9df39cf8b097..1072e2210aed 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1443,7 +1443,7 @@ static int temac_probe(struct platform_device *pdev)
 	}
 
 	/* map device registers */
-	lp->regs = devm_platform_ioremap_resource_byname(pdev, 0);
+	lp->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lp->regs)) {
 		dev_err(&pdev->dev, "could not map TEMAC registers\n");
 		return -ENOMEM;

base-commit: d95fcdf4961d27a3d17e5c7728367197adc89b8d
-- 
2.39.3 (Apple Git-146)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function
  2024-03-20 14:19 [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function Claus Hansen Ries
@ 2024-03-20 15:22 ` Simon Horman
  2024-03-20 16:06   ` Jiri Pirko
  2024-03-21 12:51 ` Paolo Abeni
  2024-03-21 13:08 ` [PATCH net v3] " Claus Hansen Ries
  2 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2024-03-20 15:22 UTC (permalink / raw)
  To: Claus Hansen Ries
  Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, michal.simek@amd.com,
	wei.fang@nxp.com, yangyingliang@huawei.com, robh@kernel.org,
	harini.katakam@amd.com, dan.carpenter@linaro.org,
	u.kleine-koenig@pengutronix.de, wanghai38@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

On Wed, Mar 20, 2024 at 02:19:15PM +0000, Claus Hansen Ries wrote:
> From: Claus Hansen Ries <chr@terma.com>
> 
> Hope I am resubmitting this correctly, I've fixed the issues in 
> the original submission.

For future reference, the text above probably belongs
below the scissors ("---"). But I don't think there
is a need to resubmit just because of that.

> 
> platform_get_resource was replaced with devm_platform_ioremap_resource_byname 
> and is called using 0 as name. This eventually ends up in platform_get_resource_byname
> in the call stack, where it causes a null pointer in strcmp.
> 
> 	if (type == resource_type(r) && !strcmp(r->name, name))
> 
> It should have been replaced with devm_platform_ioremap_resource.
> 
> Fixes: bd69058f50d5 ("net: ll_temac: Use devm_platform_ioremap_resource_byname()")
> Signed-off-by: Claus Hansen Ries <chr@terma.com>
> Cc: stable@vger.kernel.org
> ---
> v2:
>   - fix accidently converting tabs to spaces and wording in commit message
> v1: https://marc.info/?l=linux-netdev&m=171087828129633&w=2

Thanks,

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function
  2024-03-20 15:22 ` Simon Horman
@ 2024-03-20 16:06   ` Jiri Pirko
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2024-03-20 16:06 UTC (permalink / raw)
  To: Simon Horman
  Cc: Claus Hansen Ries, netdev@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	michal.simek@amd.com, wei.fang@nxp.com, yangyingliang@huawei.com,
	robh@kernel.org, harini.katakam@amd.com, dan.carpenter@linaro.org,
	u.kleine-koenig@pengutronix.de, wanghai38@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

Wed, Mar 20, 2024 at 04:22:46PM CET, horms@kernel.org wrote:
>On Wed, Mar 20, 2024 at 02:19:15PM +0000, Claus Hansen Ries wrote:
>> From: Claus Hansen Ries <chr@terma.com>
>> 
>> Hope I am resubmitting this correctly, I've fixed the issues in 
>> the original submission.
>
>For future reference, the text above probably belongs
>below the scissors ("---"). But I don't think there
>is a need to resubmit just because of that.

Well, otherwise this will be in the git history forever :)


>
>> 
>> platform_get_resource was replaced with devm_platform_ioremap_resource_byname 
>> and is called using 0 as name. This eventually ends up in platform_get_resource_byname
>> in the call stack, where it causes a null pointer in strcmp.
>> 
>> 	if (type == resource_type(r) && !strcmp(r->name, name))
>> 
>> It should have been replaced with devm_platform_ioremap_resource.
>> 
>> Fixes: bd69058f50d5 ("net: ll_temac: Use devm_platform_ioremap_resource_byname()")
>> Signed-off-by: Claus Hansen Ries <chr@terma.com>
>> Cc: stable@vger.kernel.org
>> ---
>> v2:
>>   - fix accidently converting tabs to spaces and wording in commit message
>> v1: https://marc.info/?l=linux-netdev&m=171087828129633&w=2
>
>Thanks,
>
>Reviewed-by: Simon Horman <horms@kernel.org>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function
  2024-03-20 14:19 [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function Claus Hansen Ries
  2024-03-20 15:22 ` Simon Horman
@ 2024-03-21 12:51 ` Paolo Abeni
  2024-03-21 13:08 ` [PATCH net v3] " Claus Hansen Ries
  2 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2024-03-21 12:51 UTC (permalink / raw)
  To: Claus Hansen Ries, netdev@vger.kernel.org, Simon Horman
  Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	michal.simek@amd.com, wei.fang@nxp.com, yangyingliang@huawei.com,
	robh@kernel.org, harini.katakam@amd.com, dan.carpenter@linaro.org,
	u.kleine-koenig@pengutronix.de, wanghai38@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

On Wed, 2024-03-20 at 14:19 +0000, Claus Hansen Ries wrote:
> From: Claus Hansen Ries <chr@terma.com>
> 
> Hope I am resubmitting this correctly, I've fixed the issues in 
> the original submission.

Sorry for nit picking, but please re-submit dropping the above line,
you probably don't want them in git history, too.

In the next submission you can retain the already collected RB tag.

Additionally it looks like the From matches the sender email address:
it's not needed (but it does not hurt not will produce any differences
in git history).

Cheers,

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v3] net: ll_temac: platform_get_resource replaced by wrong function
  2024-03-20 14:19 [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function Claus Hansen Ries
  2024-03-20 15:22 ` Simon Horman
  2024-03-21 12:51 ` Paolo Abeni
@ 2024-03-21 13:08 ` Claus Hansen Ries
  2024-03-26  3:10   ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Claus Hansen Ries @ 2024-03-21 13:08 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, michal.simek@amd.com, wei.fang@nxp.com,
	yangyingliang@huawei.com, robh@kernel.org, harini.katakam@amd.com,
	dan.carpenter@linaro.org, u.kleine-koenig@pengutronix.de,
	wanghai38@huawei.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Simon Horman

The function platform_get_resource was replaced with 
devm_platform_ioremap_resource_byname and is called using 0 as name. 

This eventually ends up in platform_get_resource_byname in the call 
stack, where it causes a null pointer in strcmp.

	if (type == resource_type(r) && !strcmp(r->name, name))

It should have been replaced with devm_platform_ioremap_resource.

Fixes: bd69058f50d5 ("net: ll_temac: Use devm_platform_ioremap_resource_byname()")
Signed-off-by: Claus Hansen Ries <chr@terma.com>
Cc: stable@vger.kernel.org
Reviewed-by: Simon Horman <horms@kernel.org>
---
v3:
  - Cleanup of patch message
v2: https://marc.info/?l=linux-netdev&m=171094427802626&w=2
  - fix accidently converting tabs to spaces and wording in commit message
v1: https://marc.info/?l=linux-netdev&m=171087828129633&w=2

 drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9df39cf8b097..1072e2210aed 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1443,7 +1443,7 @@ static int temac_probe(struct platform_device *pdev)
 	}
 
 	/* map device registers */
-	lp->regs = devm_platform_ioremap_resource_byname(pdev, 0);
+	lp->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lp->regs)) {
 		dev_err(&pdev->dev, "could not map TEMAC registers\n");
 		return -ENOMEM;

base-commit: d95fcdf4961d27a3d17e5c7728367197adc89b8d
-- 
2.39.3 (Apple Git-146)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v3] net: ll_temac: platform_get_resource replaced by wrong function
  2024-03-21 13:08 ` [PATCH net v3] " Claus Hansen Ries
@ 2024-03-26  3:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-26  3:10 UTC (permalink / raw)
  To: Claus Hansen Ries
  Cc: netdev, davem, edumazet, kuba, pabeni, michal.simek, wei.fang,
	yangyingliang, robh, harini.katakam, dan.carpenter,
	u.kleine-koenig, wanghai38, linux-arm-kernel, linux-kernel, horms

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 21 Mar 2024 13:08:59 +0000 you wrote:
> The function platform_get_resource was replaced with
> devm_platform_ioremap_resource_byname and is called using 0 as name.
> 
> This eventually ends up in platform_get_resource_byname in the call
> stack, where it causes a null pointer in strcmp.
> 
> 	if (type == resource_type(r) && !strcmp(r->name, name))
> 
> [...]

Here is the summary with links:
  - [net,v3] net: ll_temac: platform_get_resource replaced by wrong function
    https://git.kernel.org/netdev/net/c/3a38a829c8bc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-26  3:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20 14:19 [PATCH net v2] net: ll_temac: platform_get_resource replaced by wrong function Claus Hansen Ries
2024-03-20 15:22 ` Simon Horman
2024-03-20 16:06   ` Jiri Pirko
2024-03-21 12:51 ` Paolo Abeni
2024-03-21 13:08 ` [PATCH net v3] " Claus Hansen Ries
2024-03-26  3:10   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).