Re: [PATCH bpf-next v3 04/15] selftests/xsk: print correct error codes when exiting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 11, 2023 at 10:35:15AM +0100, Magnus Karlsson wrote:
> -						exit_with_error(-ret);
> +						exit_with_error(errno);
...
> @@ -1323,18 +1323,18 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)
>  	if (ifobject->xdp_flags & XDP_FLAGS_SKB_MODE) {
>  		if (opts.attach_mode != XDP_ATTACHED_SKB) {
>  			ksft_print_msg("ERROR: [%s] XDP prog not in SKB mode\n");
> -			exit_with_error(-EINVAL);
> +			exit_with_error(EINVAL);

My understanding is that you want exit_with_error() to always see a positive error, right?
Have you considered doing something like:
#define exit_with_error(error) ({\
  if (__builtin_constant_p(error) && error < 0) // build error;
  __exit_with_error(error, __FILE__, __func__, __LINE__);
})
would it help to catch some of these issues?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux