* [hch-misc:sockptr 30/46] net/xfrm/xfrm_state.c:2289 xfrm_user_policy() warn: passing a valid pointer to 'PTR_ERR'
@ 2020-07-17 0:33 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-07-17 0:33 UTC (permalink / raw
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4705 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Christoph Hellwig <hch@lst.de>
tree: git://git.infradead.org/users/hch/misc.git sockptr
head: ffd998f4245814309d3715c6d03c479f9585abed
commit: b684e3c7f7793431667af178c60aba13d2361481 [30/46] net/xfrm: switch xfrm_user_policy to sockptr_t
:::::: branch date: 5 hours ago
:::::: commit date: 11 hours ago
config: openrisc-randconfig-m031-20200716 (attached as .config)
compiler: or1k-linux-gcc (GCC) 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_state.c:2289 xfrm_user_policy() warn: passing a valid pointer to 'PTR_ERR'
git remote add hch-misc git://git.infradead.org/users/hch/misc.git
git remote update hch-misc
git checkout b684e3c7f7793431667af178c60aba13d2361481
vim +/PTR_ERR +2289 net/xfrm/xfrm_state.c
0f24558e9156388 Horia Geanta 2014-02-12 2266
b684e3c7f779343 Christoph Hellwig 2020-07-16 2267 int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int optlen)
^1da177e4c3f415 Linus Torvalds 2005-04-16 2268 {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2269 int err;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2270 u8 *data;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2271 struct xfrm_mgr *km;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2272 struct xfrm_policy *pol = NULL;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2273
19d7df69fdb2636 Steffen Klassert 2018-02-01 2274 if (in_compat_syscall())
19d7df69fdb2636 Steffen Klassert 2018-02-01 2275 return -EOPNOTSUPP;
19d7df69fdb2636 Steffen Klassert 2018-02-01 2276
b684e3c7f779343 Christoph Hellwig 2020-07-16 2277 if (sockptr_is_null(optval) && !optlen) {
be8f8284cd897af Lorenzo Colitti 2017-11-20 2278 xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL);
be8f8284cd897af Lorenzo Colitti 2017-11-20 2279 xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL);
be8f8284cd897af Lorenzo Colitti 2017-11-20 2280 __sk_dst_reset(sk);
be8f8284cd897af Lorenzo Colitti 2017-11-20 2281 return 0;
be8f8284cd897af Lorenzo Colitti 2017-11-20 2282 }
be8f8284cd897af Lorenzo Colitti 2017-11-20 2283
^1da177e4c3f415 Linus Torvalds 2005-04-16 2284 if (optlen <= 0 || optlen > PAGE_SIZE)
^1da177e4c3f415 Linus Torvalds 2005-04-16 2285 return -EMSGSIZE;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2286
b684e3c7f779343 Christoph Hellwig 2020-07-16 2287 data = memdup_sockptr(optval, optlen);
a133d93054fa063 Geliang Tang 2017-05-06 2288 if (IS_ERR(data))
a133d93054fa063 Geliang Tang 2017-05-06 @2289 return PTR_ERR(data);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2290
^1da177e4c3f415 Linus Torvalds 2005-04-16 2291 err = -EINVAL;
85168c0036fadf3 Cong Wang 2013-01-16 2292 rcu_read_lock();
85168c0036fadf3 Cong Wang 2013-01-16 2293 list_for_each_entry_rcu(km, &xfrm_km_list, list) {
cb969f072b6d677 Venkat Yekkirala 2006-07-24 2294 pol = km->compile_policy(sk, optname, data,
^1da177e4c3f415 Linus Torvalds 2005-04-16 2295 optlen, &err);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2296 if (err >= 0)
^1da177e4c3f415 Linus Torvalds 2005-04-16 2297 break;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2298 }
85168c0036fadf3 Cong Wang 2013-01-16 2299 rcu_read_unlock();
^1da177e4c3f415 Linus Torvalds 2005-04-16 2300
^1da177e4c3f415 Linus Torvalds 2005-04-16 2301 if (err >= 0) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 2302 xfrm_sk_policy_insert(sk, err, pol);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2303 xfrm_pol_put(pol);
2b06cdf3e688b98 Jonathan Basseri 2017-10-25 2304 __sk_dst_reset(sk);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2305 err = 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2306 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2307
^1da177e4c3f415 Linus Torvalds 2005-04-16 2308 kfree(data);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2309 return err;
^1da177e4c3f415 Linus Torvalds 2005-04-16 2310 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 2311 EXPORT_SYMBOL(xfrm_user_policy);
^1da177e4c3f415 Linus Torvalds 2005-04-16 2312
:::::: The code at line 2289 was first introduced by commit
:::::: a133d93054fa063fb3bd328abdc3d09a7e687afe xfrm: use memdup_user
:::::: TO: Geliang Tang <geliangtang@gmail.com>
:::::: CC: Steffen Klassert <steffen.klassert@secunet.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33224 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-17 0:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-17 0:33 [hch-misc:sockptr 30/46] net/xfrm/xfrm_state.c:2289 xfrm_user_policy() warn: passing a valid pointer to 'PTR_ERR' 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.