tools: ynl: handle calloc failure in ynl_ntf_parse
Subsystems (3)
PATCH 1/1 tools: ynl: handle calloc failure in ynl_ntf_parse
Check the return value of calloc() before dereferencing the allocated response structure in ynl_ntf_parse().
--- tools/net/ynl/lib/ynl.c | 3 +++ 1 file changed, 3 insertions(+)
tools/net/ynl/lib/ynl.c +3 -0
@@ -889,6 +889,9 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)return YNL_PARSE_CB_ERROR ; rsp =calloc (1 , info->alloc_sz); +if (!rsp) +return YNL_PARSE_CB_ERROR ; + rsp->free = info->free; yarg.data = rsp->data; yarg.rsp_policy = info->policy;
Signature · 1 line
2.53.0
Hi Triet,
I think your target tree is net-next, but it's close now. You can repost the patch with the net-next tag after it's reopened.
https://netdev.bots.linux.dev/net-next.html
Thanks
Hangbin
Quoted 25 lines · Triet Hoang
Check the return value of
calloc()before dereferencing the allocated response structure inynl_ntf_parse().Signed-off-by Triet Hoang <[email protected]>--- tools/net/ynl/lib/ynl.c | 3 +++ 1 file changed, 3 insertions(+)tools/net/ynl/lib/ynl.c +3
-0@@ -889,6 +889,9 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)return YNL_PARSE_CB_ERROR ; rsp =calloc (1 , info->alloc_sz); +if (!rsp) +return YNL_PARSE_CB_ERROR ; + rsp->free = info->free; yarg.data = rsp->data; yarg.rsp_policy = info->policy;Signature · 1 line
2.53.0
Jakub Kicinski
maintainerQuoted 2 lines · On Wed, 19 Aug 2026 16:11:31 +0800 Hangbin Liu wrote:
I think your target tree is net-next, but it's close now. You can repost the patch with the net-next tag after it's reopened.
It's fine, please do not send process related feedback.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 7 lines · On Tue, 18 Aug 2026 13:27:39 +0000 you wrote:
Check the return value of
calloc()before dereferencing the allocated response structure inynl_ntf_parse().Signed-off-by Triet Hoang <[email protected]>--- tools/net/ynl/lib/ynl.c | 3 +++ 1 file changed, 3 insertions(+)
Here is the summary with links:
- tools: ynl: handle calloc failure in ynl_ntf_parse
https://git.kernel.org/netdev/net/c/25b863cd6d12
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html