netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 v2] ifstat: handle strdup return value
@ 2024-03-18  9:15 Denis Kirjanov
  2024-03-20  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Kirjanov @ 2024-03-18  9:15 UTC (permalink / raw)
  To: stephen, dsahern; +Cc: netdev, Denis Kirjanov

get_nlmsg_extended is missing the check as
it's done in get_nlmsg

v2: don't set the errno value explicitly

Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
---
 misc/ifstat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/misc/ifstat.c b/misc/ifstat.c
index 685e66c9..352e5622 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -140,6 +140,10 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
 
 	n->ifindex = ifsm->ifindex;
 	n->name = strdup(ll_index_to_name(ifsm->ifindex));
+	if (!n->name) {
+		free(n);
+		return -1;
+	}
 
 	if (sub_type == NO_SUB_TYPE) {
 		memcpy(&n->val, RTA_DATA(tb[filter_type]), sizeof(n->val));
-- 
2.30.2


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

* Re: [PATCH iproute2 v2] ifstat: handle strdup return value
  2024-03-18  9:15 [PATCH iproute2 v2] ifstat: handle strdup return value Denis Kirjanov
@ 2024-03-20  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-20  4:30 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: stephen, dsahern, netdev, dkirjanov

Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Mon, 18 Mar 2024 05:15:41 -0400 you wrote:
> get_nlmsg_extended is missing the check as
> it's done in get_nlmsg
> 
> v2: don't set the errno value explicitly
> 
> Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
> 
> [...]

Here is the summary with links:
  - [iproute2,v2] ifstat: handle strdup return value
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=b22a3430bd17

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

end of thread, other threads:[~2024-03-20  4:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18  9:15 [PATCH iproute2 v2] ifstat: handle strdup return value Denis Kirjanov
2024-03-20  4:30 ` 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).