All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Change return code if failed to load object
@ 2020-04-22  8:30 ` Mao Wenan
  0 siblings, 0 replies; 34+ messages in thread
From: Mao Wenan @ 2020-04-22  8:30 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
	kpsingh
  Cc: netdev, bpf, linux-kernel, kernel-janitors

The first patch change return code from -EINVAL to -EOPNOTSUPP, 
the second patch quote the err value returned by bpf_object__load().  

Mao Wenan (2):
  bpf: Change error code when ops is NULL
  libbpf: Return err if bpf_object__load failed

 kernel/bpf/syscall.c   | 8 +++++---
 tools/lib/bpf/libbpf.c | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
@ 2020-04-24  1:46 kbuild test robot
  0 siblings, 0 replies; 34+ messages in thread
From: kbuild test robot @ 2020-04-24  1:46 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4410 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200422083010.28000-2-maowenan@huawei.com>
References: <20200422083010.28000-2-maowenan@huawei.com>
TO: Mao Wenan <maowenan@huawei.com>
TO: ast(a)kernel.org
TO: daniel(a)iogearbox.net
TO: kafai(a)fb.com
TO: songliubraving(a)fb.com
TO: yhs(a)fb.com
TO: andriin(a)fb.com
TO: john.fastabend(a)gmail.com
TO: kpsingh(a)chromium.org
CC: netdev(a)vger.kernel.org
CC: bpf(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: kernel-janitors(a)vger.kernel.org

Hi Mao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master net/master net-next/master ipvs/master v5.7-rc2 next-20200423]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Mao-Wenan/Change-return-code-if-failed-to-load-object/20200424-025339
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)

>> kernel/bpf/syscall.c:116:11: warning: No pair for character ("). Can't process file. File is either invalid or unicode, which is currently not supported. [syntaxError]
     pr_warn("map type %d not supported or
             ^

# https://github.com/0day-ci/linux/commit/45c88e856945c443c39e3f519ad9740b8e487d8d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 45c88e856945c443c39e3f519ad9740b8e487d8d
vim +116 kernel/bpf/syscall.c

a38845729ea398 Jakub Kicinski     2018-01-11  103  
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  104  static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  105  {
1110f3a9bcf394 Jakub Kicinski     2018-01-11  106  	const struct bpf_map_ops *ops;
9ef09e35e521bf Mark Rutland       2018-05-03  107  	u32 type = attr->map_type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  108  	struct bpf_map *map;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  109  	int err;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  110  
9ef09e35e521bf Mark Rutland       2018-05-03  111  	if (type >= ARRAY_SIZE(bpf_map_types))
1110f3a9bcf394 Jakub Kicinski     2018-01-11  112  		return ERR_PTR(-EINVAL);
9ef09e35e521bf Mark Rutland       2018-05-03  113  	type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
9ef09e35e521bf Mark Rutland       2018-05-03  114  	ops = bpf_map_types[type];
45c88e856945c4 Mao Wenan          2020-04-22  115  	if (!ops) {
45c88e856945c4 Mao Wenan          2020-04-22 @116  		pr_warn("map type %d not supported or
45c88e856945c4 Mao Wenan          2020-04-22  117  			 kernel config not opened\n", type);
45c88e856945c4 Mao Wenan          2020-04-22  118  		return ERR_PTR(-EOPNOTSUPP);
45c88e856945c4 Mao Wenan          2020-04-22  119  	}
1110f3a9bcf394 Jakub Kicinski     2018-01-11  120  	if (ops->map_alloc_check) {
1110f3a9bcf394 Jakub Kicinski     2018-01-11  121  		err = ops->map_alloc_check(attr);
1110f3a9bcf394 Jakub Kicinski     2018-01-11  122  		if (err)
1110f3a9bcf394 Jakub Kicinski     2018-01-11  123  			return ERR_PTR(err);
1110f3a9bcf394 Jakub Kicinski     2018-01-11  124  	}
a38845729ea398 Jakub Kicinski     2018-01-11  125  	if (attr->map_ifindex)
a38845729ea398 Jakub Kicinski     2018-01-11  126  		ops = &bpf_map_offload_ops;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  127  	map = ops->map_alloc(attr);
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  128  	if (IS_ERR(map))
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  129  		return map;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  130  	map->ops = ops;
9ef09e35e521bf Mark Rutland       2018-05-03  131  	map->map_type = type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  132  	return map;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  133  }
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  134  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL
@ 2020-04-24 13:41 kbuild test robot
  0 siblings, 0 replies; 34+ messages in thread
From: kbuild test robot @ 2020-04-24 13:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 8215 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200422083010.28000-2-maowenan@huawei.com>
References: <20200422083010.28000-2-maowenan@huawei.com>
TO: Mao Wenan <maowenan@huawei.com>
TO: ast(a)kernel.org
TO: daniel(a)iogearbox.net
TO: kafai(a)fb.com
TO: songliubraving(a)fb.com
TO: yhs(a)fb.com
TO: andriin(a)fb.com
TO: john.fastabend(a)gmail.com
TO: kpsingh(a)chromium.org
CC: netdev(a)vger.kernel.org
CC: bpf(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: kernel-janitors(a)vger.kernel.org

Hi Mao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master net/master net-next/master ipvs/master v5.7-rc2 next-20200423]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Mao-Wenan/Change-return-code-if-failed-to-load-object/20200424-025339
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-191-gc51a0382-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> kernel/bpf/syscall.c:117:0: sparse: sparse: missing terminating " character
   kernel/bpf/syscall.c:118:0: sparse: sparse: missing terminating " character
>> kernel/bpf/syscall.c:686:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:772:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:979:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1046:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1111:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1164:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1341:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1442:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1504:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1548:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1550:1: sparse: sparse: directive in macro's argument list
   kernel/bpf/syscall.c:1551:1: sparse: sparse: directive in macro's argument list
>> kernel/bpf/syscall.c:116:17: sparse: sparse: macro "pr_warn" passed 2 arguments, but takes just 2
>> include/linux/bpf_types.h:7:1: sparse: sparse: No right hand side of ','-expression
   include/linux/bpf_types.h:7:1: sparse: sparse: Expected ; at end of statement
   include/linux/bpf_types.h:7:1: sparse: sparse: got [
   include/linux/bpf_types.h:121:0: sparse: sparse: Expected } at end of compound statement
   include/linux/bpf_types.h:121:0: sparse: sparse: got end-of-input
   include/linux/bpf_types.h:121:0: sparse: sparse: Expected } at end of function
   include/linux/bpf_types.h:121:0: sparse: sparse: got end-of-input
   kernel/bpf/syscall.c:116:17: sparse: sparse: undefined identifier 'pr_warn'
   kernel/bpf/syscall.c:1560:21: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1560:21: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1562:16: sparse: sparse: undefined identifier 'bpf_prog_types'
>> kernel/bpf/syscall.c:1562:16: sparse: sparse: cannot size expression
   kernel/bpf/syscall.c:1563:15: sparse: sparse: undefined identifier 'bpf_prog_types'
   kernel/bpf/syscall.c:1797:27: sparse: sparse: undefined identifier 'bpf_dummy_read'
   kernel/bpf/syscall.c:1798:27: sparse: sparse: undefined identifier 'bpf_dummy_write'
   kernel/bpf/syscall.c:2293:27: sparse: sparse: undefined identifier 'bpf_dummy_read'
   kernel/bpf/syscall.c:2294:27: sparse: sparse: undefined identifier 'bpf_dummy_write'
   kernel/bpf/syscall.c:2870:23: sparse: sparse: undefined identifier '__bpf_map_inc_not_zero'
   kernel/bpf/syscall.c:3538:15: sparse: sparse: undefined identifier 'map_get_sys_perms'
   kernel/bpf/syscall.c:3544:15: sparse: sparse: undefined identifier 'map_get_sys_perms'
   kernel/bpf/syscall.c:3685:23: sparse: sparse: undefined identifier 'map_create'
   kernel/bpf/syscall.c:3688:23: sparse: sparse: undefined identifier 'map_lookup_elem'
   kernel/bpf/syscall.c:3691:23: sparse: sparse: undefined identifier 'map_update_elem'
   kernel/bpf/syscall.c:3694:23: sparse: sparse: undefined identifier 'map_delete_elem'
   kernel/bpf/syscall.c:3697:23: sparse: sparse: undefined identifier 'map_get_next_key'
   kernel/bpf/syscall.c:3700:23: sparse: sparse: undefined identifier 'map_freeze'
   kernel/bpf/syscall.c:3757:23: sparse: sparse: undefined identifier 'map_lookup_and_delete_elem'

# https://github.com/0day-ci/linux/commit/45c88e856945c443c39e3f519ad9740b8e487d8d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 45c88e856945c443c39e3f519ad9740b8e487d8d
vim +117 kernel/bpf/syscall.c

a38845729ea398 Jakub Kicinski     2018-01-11  103  
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  104  static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  105  {
1110f3a9bcf394 Jakub Kicinski     2018-01-11  106  	const struct bpf_map_ops *ops;
9ef09e35e521bf Mark Rutland       2018-05-03  107  	u32 type = attr->map_type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  108  	struct bpf_map *map;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  109  	int err;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  110  
9ef09e35e521bf Mark Rutland       2018-05-03  111  	if (type >= ARRAY_SIZE(bpf_map_types))
1110f3a9bcf394 Jakub Kicinski     2018-01-11  112  		return ERR_PTR(-EINVAL);
9ef09e35e521bf Mark Rutland       2018-05-03  113  	type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
9ef09e35e521bf Mark Rutland       2018-05-03  114  	ops = bpf_map_types[type];
45c88e856945c4 Mao Wenan          2020-04-22  115  	if (!ops) {
45c88e856945c4 Mao Wenan          2020-04-22 @116  		pr_warn("map type %d not supported or
45c88e856945c4 Mao Wenan          2020-04-22 @117  			 kernel config not opened\n", type);
45c88e856945c4 Mao Wenan          2020-04-22  118  		return ERR_PTR(-EOPNOTSUPP);
45c88e856945c4 Mao Wenan          2020-04-22  119  	}
1110f3a9bcf394 Jakub Kicinski     2018-01-11  120  	if (ops->map_alloc_check) {
1110f3a9bcf394 Jakub Kicinski     2018-01-11  121  		err = ops->map_alloc_check(attr);
1110f3a9bcf394 Jakub Kicinski     2018-01-11  122  		if (err)
1110f3a9bcf394 Jakub Kicinski     2018-01-11  123  			return ERR_PTR(err);
1110f3a9bcf394 Jakub Kicinski     2018-01-11  124  	}
a38845729ea398 Jakub Kicinski     2018-01-11  125  	if (attr->map_ifindex)
a38845729ea398 Jakub Kicinski     2018-01-11  126  		ops = &bpf_map_offload_ops;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  127  	map = ops->map_alloc(attr);
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  128  	if (IS_ERR(map))
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  129  		return map;
1110f3a9bcf394 Jakub Kicinski     2018-01-11  130  	map->ops = ops;
9ef09e35e521bf Mark Rutland       2018-05-03  131  	map->map_type = type;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  132  	return map;
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  133  }
99c55f7d47c0dc Alexei Starovoitov 2014-09-26  134  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

end of thread, other threads:[~2020-04-30  2:04 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  8:30 [PATCH bpf-next 0/2] Change return code if failed to load object Mao Wenan
2020-04-22  8:30 ` Mao Wenan
2020-04-22  8:30 ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-22  8:30   ` Mao Wenan
2020-04-22  9:33   ` Dan Carpenter
2020-04-22  9:33     ` Dan Carpenter
2020-04-23  3:33     ` [PATCH bpf-next v2 0/2] Change return code if failed to load object Mao Wenan
2020-04-23  3:33       ` Mao Wenan
2020-04-23  3:33       ` [PATCH bpf-next v2 1/2] bpf: Change error code when ops is NULL Mao Wenan
2020-04-23  3:33         ` Mao Wenan
2020-04-23  5:43         ` Alexei Starovoitov
2020-04-23  5:43           ` Alexei Starovoitov
2020-04-23  6:25           ` maowenan
2020-04-23  6:25             ` maowenan
2020-04-23 16:07             ` Alexei Starovoitov
2020-04-23 16:07               ` Alexei Starovoitov
2020-04-24  1:13               ` maowenan
2020-04-24  1:13                 ` maowenan
2020-04-23  3:33       ` [PATCH bpf-next v2 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
2020-04-23  3:33         ` Mao Wenan
2020-04-24  5:10   ` [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL kbuild test robot
2020-04-24  5:10     ` kbuild test robot
2020-04-24  5:10     ` kbuild test robot
2020-04-24  5:18   ` kbuild test robot
2020-04-24  5:18     ` kbuild test robot
2020-04-30  1:55   ` kbuild test robot
2020-04-30  2:04     ` kbuild test robot
2020-04-30  2:04     ` kbuild test robot
2020-04-22  8:30 ` [PATCH bpf-next 2/2] libbpf: Return err if bpf_object__load failed Mao Wenan
2020-04-22  8:30   ` Mao Wenan
2020-04-22 23:27   ` Andrii Nakryiko
2020-04-22 23:27     ` Andrii Nakryiko
2020-04-24  1:46 [PATCH bpf-next 1/2] bpf: Change error code when ops is NULL kbuild test robot
2020-04-24 13:41 kbuild 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.