netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] xfrm: Return the correct errno code
@ 2021-02-04  7:42 Zheng Yongjun
  2021-02-06  7:12 ` Steffen Klassert
  0 siblings, 1 reply; 4+ messages in thread
From: Zheng Yongjun @ 2021-02-04  7:42 UTC (permalink / raw)
  To: steffen.klassert, herbert, davem, kuba, netdev, linux-kernel
  Cc: Zheng Yongjun

When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 net/xfrm/xfrm_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d0c32a8fcc4a..ad63a6c77edd 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2444,7 +2444,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
 		encap = kmemdup(nla_data(attrs[XFRMA_ENCAP]),
 				sizeof(*encap), GFP_KERNEL);
 		if (!encap)
-			return 0;
+			return -ENOMEM;
 	}
 
 	err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH net-next] xfrm: Return the correct errno code
@ 2021-06-04  1:46 Zheng Yongjun
  2021-06-04  1:34 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Zheng Yongjun @ 2021-06-04  1:46 UTC (permalink / raw)
  To: steffen.klassert, herbert, davem, kuba, netdev, linux-kernel
  Cc: Zheng Yongjun

When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 net/xfrm/xfrm_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index f0aecee4d539..4f9c86807bc4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3159,7 +3159,7 @@ static struct xfrm_policy *xfrm_compile_policy(struct sock *sk, int opt,
 
 	xp = xfrm_policy_alloc(net, GFP_ATOMIC);
 	if (xp == NULL) {
-		*dir = -ENOBUFS;
+		*dir = -ENOMEM;
 		return NULL;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2021-06-04  1:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-04  7:42 [PATCH net-next] xfrm: Return the correct errno code Zheng Yongjun
2021-02-06  7:12 ` Steffen Klassert
  -- strict thread matches above, loose matches on Subject: below --
2021-06-04  1:46 Zheng Yongjun
2021-06-04  1:34 ` Herbert Xu

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).