lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190412165725.6ad21acb@cakuba.netronome.com>
Date:   Fri, 12 Apr 2019 16:57:34 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Benjamin Poirier <bpoirier@...e.com>
Cc:     Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, David Ahern <dsahern@...il.com>
Subject: Re: [PATCH v2 bpf-next 1/2] bpftool: Use print_entry_error() in
 case of ENOENT when dumping

On Fri, 12 Apr 2019 12:03:21 +0900, Benjamin Poirier wrote:
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index e96903078991..71840faaeab5 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -261,20 +261,19 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
>  }
>  
>  static void print_entry_error(struct bpf_map_info *info, unsigned char *key,
> -			      const char *value)
> +			      const char *value, bool single_line)
>  {
> -	int value_size = strlen(value);
> -	bool single_line, break_names;
> +	bool break_names;

I'd rather you kept the strlen() and 16 char limitation logic.

> -	break_names = info->key_size > 16 || value_size > 16;
> -	single_line = info->key_size + value_size <= 24 && !break_names;
> +	break_names = info->key_size > 16;
> +	single_line = single_line && !break_names;
>  
>  	printf("key:%c", break_names ? '\n' : ' ');
>  	fprint_hex(stdout, key, info->key_size, " ");
>  
>  	printf(single_line ? "  " : "\n");
>  
> -	printf("value:%c%s", break_names ? '\n' : ' ', value);
> +	printf("value:%c%s", single_line ? ' ' : '\n', value);
>  
>  	printf("\n");
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ