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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Jan 2019 17:46:18 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, ast@...nel.org,
        daniel@...earbox.net, quentin.monnet@...ronome.com
Subject: Re: [PATCH bpf-next 6/6] bpftool: add pop and dequeue commands

On Tue, 15 Jan 2019 15:22:52 -0800, Stanislav Fomichev wrote:
> +static int do_pop_dequeue(int argc, char **argv)
> +{
> +	struct bpf_map_info info = {};
> +	__u32 len = sizeof(info);
> +	void *key, *value;
> +	int err;
> +	int fd;
> +
> +	if (argc < 2)
> +		usage();
> +
> +	fd = map_parse_fd_and_info(&argc, &argv, &info, &len);
> +	if (fd < 0)
> +		return -1;
> +
> +	err = alloc_key_value(&info, &key, &value);
> +	if (err)
> +		goto exit_free;
> +
> +	err = bpf_map_lookup_and_delete_elem(fd, key, value);
> +	if (err) {
> +		if (errno == ENOENT) {
> +			if (json_output)
> +				jsonw_null(json_wtr);
> +			else
> +				printf("Error: empty map\n");
> +		} else {
> +			p_err("pop failed: %s", strerror(errno));
> +		}
> +
> +		goto exit_free;
> +	}
> +
> +	print_key_value(&info, key, value);
> +
> +exit_free:
> +	free(key);
> +	free(value);
> +	close(fd);
> +
> +	if (!err && json_output)
> +		jsonw_null(json_wtr);

These two lines look out of place?

> +	return err;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ