* [android-common:android-4.19-stable 5/7] net/xfrm/xfrm_compat.c:566 xfrm_user_rcv_msg_compat() error: kvmalloc() only makes sense with GFP_KERNEL
@ 2021-03-05 5:18 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-05 5:18 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4483 bytes --]
CC: kbuild-all(a)01.org
TO: cros-kernel-buildreports(a)googlegroups.com
tree: https://android.googlesource.com/kernel/common android-4.19-stable
head: d624a2b1ab038e889d9c58c88ce02c79d16191c3
commit: 77d2c7b99a784f21cba4d3e365b65777e54b3941 [5/7] BACKPORT: xfrm/compat: Add 32=>64-bit messages translator
:::::: branch date: 4 months ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-m001-20210305 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
net/xfrm/xfrm_compat.c:566 xfrm_user_rcv_msg_compat() error: kvmalloc() only makes sense with GFP_KERNEL
vim +566 net/xfrm/xfrm_compat.c
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 532
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 533 static struct nlmsghdr *xfrm_user_rcv_msg_compat(const struct nlmsghdr *h32,
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 534 int maxtype, const struct nla_policy *policy,
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 535 struct netlink_ext_ack *extack)
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 536 {
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 537 /* netlink_rcv_skb() checks if a message has full (struct nlmsghdr) */
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 538 u16 type = h32->nlmsg_type - XFRM_MSG_BASE;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 539 struct nlattr *attrs[XFRMA_MAX+1];
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 540 struct nlmsghdr *h64;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 541 size_t len;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 542 int err;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 543
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 544 BUILD_BUG_ON(ARRAY_SIZE(xfrm_msg_min) != ARRAY_SIZE(compat_msg_min));
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 545
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 546 if (type >= ARRAY_SIZE(xfrm_msg_min))
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 547 return ERR_PTR(-EINVAL);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 548
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 549 /* Don't call parse: the message might have only nlmsg header */
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 550 if ((h32->nlmsg_type == XFRM_MSG_GETSA ||
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 551 h32->nlmsg_type == XFRM_MSG_GETPOLICY) &&
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 552 (h32->nlmsg_flags & NLM_F_DUMP))
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 553 return NULL;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 554
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 555 err = nlmsg_parse(h32, compat_msg_min[type], attrs,
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 556 maxtype ? : XFRMA_MAX, policy ? : compat_policy, extack);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 557 if (err < 0)
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 558 return ERR_PTR(err);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 559
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 560 len = xfrm_user_rcv_calculate_len64(h32, attrs);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 561 /* The message doesn't need translation */
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 562 if (len == nlmsg_len(h32))
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 563 return NULL;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 564
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 565 len += NLMSG_HDRLEN;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 @566 h64 = kvmalloc(len, GFP_KERNEL | __GFP_ZERO);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 567 if (!h64)
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 568 return ERR_PTR(-ENOMEM);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 569
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 570 err = xfrm_xlate32(h64, h32, attrs, len, type, extack);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 571 if (err < 0) {
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 572 kvfree(h64);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 573 return ERR_PTR(err);
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 574 }
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 575
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 576 return h64;
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 577 }
77d2c7b99a784f2 Dmitry Safonov 2020-09-21 578
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33202 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-05 5:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 5:18 [android-common:android-4.19-stable 5/7] net/xfrm/xfrm_compat.c:566 xfrm_user_rcv_msg_compat() error: kvmalloc() only makes sense with GFP_KERNEL kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.