Received: by 10.223.164.202 with SMTP id h10csp751505wrb; Thu, 30 Nov 2017 19:14:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMZsNIKgmIzT0looVlK/LoICaJNn5HTPLJBGPjL9ifqZKxn+gAb42fcYlPT944oirJzZFHNo X-Received: by 10.99.145.199 with SMTP id l190mr4418101pge.132.1512098062581; Thu, 30 Nov 2017 19:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512098062; cv=none; d=google.com; s=arc-20160816; b=zKxXUH8AI/PITMDxt43paJRPHsJoTAWlCLloY0CCf1UaaWlzRGhIlC49I8Jzw/LDir d+QKM/N7HHrPZs9urYJMFAUKdwEcWr+XIIj6VloH79Kcvmz18IB9elfdYJURcT4/pUiD h5qwW9OtweeywNt+++N6rKOHWBzaYvh0KCQzLI1lYFgCb+6cgtaRG9X/5cgZsf5rjfon I9J+gL63QNrgTnChNmVpWIXeCgMxR/xR5hkaR3RT9GovE0yooSR4RFEUjUq9lLrqa4PN pAyZmmaRXksSdB3EbVyGDHa7Dk5DZ8LLlFoIs7PCE6Y9n2fBEy7Y8xIG/HjFrxszdsxH 88XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=8hYCgpsl0iar6gmfH02g7iP5nExcCLyg0kexqdlMAfs=; b=pYZzfsZB/VUv9MNqF8RtcBw9/v5XcB5Q5LqiNsVRUOJia5Ugym2I1oMDVR+weAAn41 wWf7FVc4kmv5lWBU2yUAzTXuPmHD29ywms2ol0HSCASYfqwlEV8tHbo6o8upaWUaPK9S +XWX25zHX8MSS6PVpMaNCY8mxrwFb0172Lc0rXCCt9hpF0MEIDhe6ebwbTeaglEZD/oB N8TvCFz7PEneA/Wb0R9pIuDi01oxIhlu9mmJHpyfO+36HkfWvHLxoLJxB+B1Q7SPslQ1 eCRyLmimU+XZI9dLTNTMLeCx7RVYzMjarVFAJ27wvzmGn/ygl8YJaTalYBSVdLZE9SgS 29LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=fn/idP69; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si4062282pgd.769.2017.11.30.19.14.08; Thu, 30 Nov 2017 19:14:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=fn/idP69; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752242AbdLADOA (ORCPT + 99 others); Thu, 30 Nov 2017 22:14:00 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:33447 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751642AbdLADN6 (ORCPT ); Thu, 30 Nov 2017 22:13:58 -0500 Received: by mail-pg0-f42.google.com with SMTP id g7so3906074pgs.0 for ; Thu, 30 Nov 2017 19:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=8hYCgpsl0iar6gmfH02g7iP5nExcCLyg0kexqdlMAfs=; b=fn/idP69r6qzpD5KTu8QobbmBRM8LMcg1Mp7KZGHJsMbjq24X/sZDJlZHd6f6Sjs32 nhxrHp08C7W2DDFDpPfIlpYGCF02kO6lR94ykXp/qKh/xUnRhDHhPWRHBp/OpKjub3/a CBj5idJ9Ymp0k0KkBOpGEaj+KF6ynLWUbeUEeG6t3Y0uaprVGzL7BpRnAtjDLN5n3Q4N jAKL9YOiNyzSWl/lZuS8tp6grxo1AcJEL3Peg1Xl2+ZBh2yFtkEXWfJi+13sh6D6IBdp HohvJyv+D7bFlQSQ1H8Xd237CO5rFb6x4AUv2wWY8yrGt/HGuQy9e5/DqgQmOTr5kpXZ bOBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=8hYCgpsl0iar6gmfH02g7iP5nExcCLyg0kexqdlMAfs=; b=ZzFwIXoYicYXbpkNg95Ch0KuaVL8hk5Gkj2RmVikq/+8AF9wNVYG000Dhknh/DLRNw vxnvquvDzxuozhsopWdSznarNqA37fcew7Exw+/nOLKHWl7wnDeBFx0EYK5nNNARFInX vdqBZjucJbJdcWkc5tOxbERu7ag8LhL2ezaWhTWZ2kG9lglh89uMGGnZxR1qtUQrQIDr e1uCWYAAe7AjGHEDgj7+21+da2P4DwZf4ugzbxvVUOD7CWkb+7Jx7xd39BcJJAN5VUyQ w2+k1OgAxeFVRMUsOBv7SAlvm89OTKS5pFmIdAjuliQe0XZxCty6abbtXJgjtFDNmmxb Zb6g== X-Gm-Message-State: AJaThX5Xd0EPgaa6e+FE59WweGot5SkGw4xtkOmwtbIxP4ZNqgEJQzDY VTkv35JoXLFXcRM0bjFJt+3dug== X-Received: by 10.98.59.139 with SMTP id w11mr8930247pfj.188.1512098036492; Thu, 30 Nov 2017 19:13:56 -0800 (PST) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id t75sm10012779pfi.146.2017.11.30.19.13.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Nov 2017 19:13:56 -0800 (PST) Date: Thu, 30 Nov 2017 19:13:53 -0800 From: Jakub Kicinski To: Roman Gushchin Cc: , , , , , Subject: Re: [PATCH net-next 3/5] bpftool: implement cgattach command Message-ID: <20171130191353.3a46ff6e@cakuba.netronome.com> In-Reply-To: <20171130134302.2840-4-guro@fb.com> References: <20171130134302.2840-1-guro@fb.com> <20171130134302.2840-4-guro@fb.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. From 1585510237259751156@xxx Thu Nov 30 16:46:31 +0000 2017 X-GM-THRID: 1585498885690075033 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread