netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
@ 2024-01-11  7:20 Kunwu Chan
  2024-01-11 13:47 ` Simon Horman
  2024-01-17  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-01-11  7:20 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Kunwu Chan, Kunwu Chan

devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.

Cc: Kunwu Chan <kunwu.chan@hotmail.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Suggested-by: Jakub Kicinski <kuba@kernel.org>

---
v2: Remove error print
---
 drivers/net/dsa/vitesse-vsc73xx-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
index e6f29e4e508c..571f037fe649 100644
--- a/drivers/net/dsa/vitesse-vsc73xx-core.c
+++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
@@ -1135,6 +1135,8 @@ static int vsc73xx_gpio_probe(struct vsc73xx *vsc)
 
 	vsc->gc.label = devm_kasprintf(vsc->dev, GFP_KERNEL, "VSC%04x",
 				       vsc->chipid);
+	if (!vsc->gc.label)
+		return -ENOMEM;
 	vsc->gc.ngpio = 4;
 	vsc->gc.owner = THIS_MODULE;
 	vsc->gc.parent = vsc->dev;
-- 
2.39.2


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

* Re: [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
  2024-01-11  7:20 [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe Kunwu Chan
@ 2024-01-11 13:47 ` Simon Horman
  2024-01-17  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-01-11 13:47 UTC (permalink / raw)
  To: Kunwu Chan
  Cc: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel, Kunwu Chan

On Thu, Jan 11, 2024 at 03:20:18PM +0800, Kunwu Chan wrote:
> devm_kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
> 
> Cc: Kunwu Chan <kunwu.chan@hotmail.com>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>

Hi Kunwu,

This seems to be a bug fix. If so it should have a fixes tag.
Perhaps this one is correct?

	Fixes: 05bd97fc559d ("net: dsa: Add Vitesse VSC73xx DSA router driver")

And, be targeted against net (as opposed to net-next)

	Subject: [PATCH net v2] ...

It is probably not necessary to repost to address these minor issues,
but please keep this in mind in future.

The above notwithstanding,

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

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

* Re: [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
  2024-01-11  7:20 [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe Kunwu Chan
  2024-01-11 13:47 ` Simon Horman
@ 2024-01-17  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-17  1:50 UTC (permalink / raw)
  To: Kunwu Chan
  Cc: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel, kunwu.chan

Hello:

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

On Thu, 11 Jan 2024 15:20:18 +0800 you wrote:
> devm_kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
> 
> Cc: Kunwu Chan <kunwu.chan@hotmail.com>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
    https://git.kernel.org/netdev/net/c/776dac5a6627

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] 3+ messages in thread

end of thread, other threads:[~2024-01-17  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11  7:20 [PATCH v2] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe Kunwu Chan
2024-01-11 13:47 ` Simon Horman
2024-01-17  1:50 ` 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).