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: <20171130191353.3a46ff6e@cakuba.netronome.com>
Date:   Thu, 30 Nov 2017 19:13:53 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Roman Gushchin <guro@...com>
Cc:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <kernel-team@...com>, <ast@...nel.org>, <daniel@...earbox.net>,
        <kafai@...com>
Subject: Re: [PATCH net-next 3/5] bpftool: implement cgattach command

On Thu, 30 Nov 2017 13:43:00 +0000, Roman Gushchin wrote:
> +	attach_type = parse_attach_type(argv[2]);
> +	if (attach_type == __MAX_BPF_ATTACH_TYPE) {
> +		bpf_object__close(obj);
> +		close(prog_fd);
> +		close(cgroup_fd);
> +		p_err("Invalid attach type\n");
> +		return -1;
> +	}
> +
> +	if (bpf_prog_attach(prog_fd, cgroup_fd, attach_type, 0)) {
> +		bpf_object__close(obj);
> +		close(prog_fd);
> +		close(cgroup_fd);
> +		p_err("Failed to attach program");
> +		return -1;
> +	}
> +
> +	bpf_object__close(obj);
> +	close(prog_fd);
> +	close(cgroup_fd);
> +
> +	return 0;
> +}

Could you try to consolidate the error paths into a one larger handler
and use gotos to jump to it?  You can see it done in number of places,
grep for e.g. exit_free.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ