summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZhao Dongdong <zhaodongdong@kylinos.cn>2026-05-26 14:51:56 +0800
committerJakub Kicinski <kuba@kernel.org>2026-05-27 17:37:50 -0700
commit36d0d876c45f7ee7935edfce7f5687a2969a2249 (patch)
tree32f1f83948295f7ea46e94418dfb09e56dfb00a6 /net
parent3cefa8d5e798c4e21a7ea48bf6370247fca3aa9d (diff)
downloadlinux-next-36d0d876c45f7ee7935edfce7f5687a2969a2249.tar.gz
linux-next-36d0d876c45f7ee7935edfce7f5687a2969a2249.zip
net: page_pool: silence static analysis warnings in page_pool_nl_stats_fill()
nla_nest_start() can return NULL if the skb runs out of space. Jakub: There is no bug here, if nla_nest_start() failed there's not space left in the message. Next nla_put_uint() will also fail and we will exit via nla_nest_cancel() which handles NULL just fine. Various people keep sending us this patch so let's commit this. Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Link: https://patch.msgid.link/tencent_A82EBAB365A8B888B66FDCF115A3DCB8880A@qq.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/page_pool_user.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c
index 01509d1b3cba..1cdef13e6cea 100644
--- a/net/core/page_pool_user.c
+++ b/net/core/page_pool_user.c
@@ -135,6 +135,8 @@ page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool,
return -EMSGSIZE;
nest = nla_nest_start(rsp, NETDEV_A_PAGE_POOL_STATS_INFO);
+ if (!nest)
+ goto err_cancel_msg;
if (nla_put_uint(rsp, NETDEV_A_PAGE_POOL_ID, pool->user.id) ||
(pool->slow.netdev->ifindex != LOOPBACK_IFINDEX &&