Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4443936ybi; Mon, 3 Jun 2019 10:57:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyluHLbA96dnSB/MK8iIGwpOOCurvsp9FF/j3H3WXn+VKendk/Ax4ckcLY/gJIcsOKRJa9n X-Received: by 2002:a63:d816:: with SMTP id b22mr29542406pgh.16.1559584666789; Mon, 03 Jun 2019 10:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559584666; cv=none; d=google.com; s=arc-20160816; b=0Fp2gm4rYUWF7M0u+4/AWHJogKccbdTb4mrd/NhjcCWtT1WUF1RohQW9cEXpgxbqlo 0QhgTVAIvBUhlnPL9vPbE25znsQzccRBM03VYDQnYjUkQ5nknMp5dV4IPBrU9yWoo1an XjaPeqNvEGU9OW8i/X3IRnA1vEurHV5J2W7wYvKhYoH7tWX6/1NNp+f4cfa1Rv1LWmrX FcF16D5iAn8ff3tq+L1bWSpkk0ZvtvAyTfkQ0laxchLqNOrF30jGKX/QnYxrOEdlpINs pBccsal/Uubv3PxJ/0cTFLLw1ZXfAIfbMzvKERHkizVilEAsCCpvhCZezbIfItdnctPJ oERw== 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; bh=YGNZXdoeRNmz7BqeF0/v3i59X3wiJHrSCMaZEz5idac=; b=BU/l4T/Ww8uEajA4aM0PuuJXWjYLSp/5lzSy8cSUoLIHU6QdJKHN5xKD70s/RrvzTm 2iIciycL3cA7YQ2Jo9389ExIhGajVfME2AdlMO49/4wx56lpcQC7ZByL2omBiJm36eWi FWeGtDyTJXJDMPcGdx12DE4b9GyTwp8Pbel9t8iTr2BNGInE7+P2GR310QF8sx5x4MP/ 1b/CFs5OihEKuEJvy4kdecl+zCIRxICfM5o8/PToLwD8lplYNjxSkFFozqYGM6EwnyEK xcsNie0WrujW2u1YcxMboI7qT+XUdN8SrWBScMXhGIDdYJ0b1a1/yk/RnuHs+fR0gUdT mH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="UaVuEr/k"; 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 q7si20624325pff.49.2019.06.03.10.57.30; Mon, 03 Jun 2019 10:57:46 -0700 (PDT) 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="UaVuEr/k"; 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 S1727383AbfFCRtk (ORCPT + 99 others); Mon, 3 Jun 2019 13:49:40 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39612 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfFCRth (ORCPT ); Mon, 3 Jun 2019 13:49:37 -0400 Received: by mail-qt1-f194.google.com with SMTP id i34so10437056qta.6 for ; Mon, 03 Jun 2019 10:49:36 -0700 (PDT) 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=YGNZXdoeRNmz7BqeF0/v3i59X3wiJHrSCMaZEz5idac=; b=UaVuEr/kuy5hiq44Vf2xKm1Yj7c+f/OmHOwwwaNBE+hEEHXF2JMkizF7W0TNG0ZqOV vAVGiZfmwhJNGAgCvAwCEhC1PlGwzWbBUyCLkgOrSi7zvR0FxhY8W1dJelfaN/00dRWc 97P8ELdZwEXFh0hdUXrMdmEPvlEVZ51R4ltg0ecUrBNziApYmpfYaVpnkP+bkP2otft+ lmVLkL3cATiX1Uxg1dV/nKaKl5/rore1zlk0dVi5wn/2NoB6BLWN4UFAlG2KYsqcomDC iSM/Vgcuf5WgI+Kxky6hG1HH47rBWZ0MWU2MSoJ5sSqrZ21p0sl7SGN6kTgzFeEOlqww nQHQ== 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=YGNZXdoeRNmz7BqeF0/v3i59X3wiJHrSCMaZEz5idac=; b=UJqQqXSo+KXPkIcu/53o0a/47zwX/RTOqbg+ko/T2OFyUSeVGfAInLWKa6Jp1WWf68 9lvPcnXpzi42JKzN2hXCBqV/ffC/UV7/TCu6t+f1cIGw6Pg9UBYzDOcRUlSseFKodLAD EVxsI4x3QjBPArlFggHbFglyt6N9Lum/2KT0XjLIh/AGuEJUsBf9Ei5HZwM0EU9bvQ0U /cH6rF88FbV1RZVXdofmDduD09xxYVbhd0D1vt6OQLwYlP1Aw5j0rwlIZGd1F2ywZYWe XgVJKtBEBBkO/c7aKTHY4e6A3G6m+ZDADqHHJYUFyTe8RkuJxN3bfV9b+osdiORyFGeL G6fw== X-Gm-Message-State: APjAAAWTNq7WR8UmQorDuwpUSMRWKf3K9tRuCaGYYXKdXhwbbNvojGyk r4fpRGqaISY9jlJY9Yv2D1Ty9g== X-Received: by 2002:a0c:b5c7:: with SMTP id o7mr22920460qvf.220.1559584175979; Mon, 03 Jun 2019 10:49:35 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id e133sm11972673qkb.76.2019.06.03.10.49.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 03 Jun 2019 10:49:35 -0700 (PDT) Date: Mon, 3 Jun 2019 10:49:30 -0700 From: Jakub Kicinski To: Colin Ian King Cc: Alexei Starovoitov , Daniel Borkmann , "David S . Miller" , Jesper Dangaard Brouer , John Fastabend , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , netdev@vger.kernel.org, xdp-newbies@vger.kernel.org, bpf@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] bpf: remove redundant assignment to err Message-ID: <20190603104930.466a306b@cakuba.netronome.com> In-Reply-To: <276525bd-dd79-052e-7663-9acc92621853@canonical.com> References: <20190603170247.9951-1-colin.king@canonical.com> <20190603102140.70fee157@cakuba.netronome.com> <276525bd-dd79-052e-7663-9acc92621853@canonical.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 Mon, 3 Jun 2019 18:39:16 +0100, Colin Ian King wrote: > On 03/06/2019 18:21, Jakub Kicinski wrote: > > On Mon, 3 Jun 2019 18:02:47 +0100, Colin King wrote: > >> From: Colin Ian King > >> > >> The variable err is assigned with the value -EINVAL that is never > >> read and it is re-assigned a new value later on. The assignment is > >> redundant and can be removed. > >> > >> Addresses-Coverity: ("Unused value") > >> Signed-off-by: Colin Ian King > >> --- > >> kernel/bpf/devmap.c | 2 +- > >> kernel/bpf/xskmap.c | 2 +- > >> 2 files changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c > >> index 5ae7cce5ef16..a76cc6412fc4 100644 > >> --- a/kernel/bpf/devmap.c > >> +++ b/kernel/bpf/devmap.c > >> @@ -88,7 +88,7 @@ static u64 dev_map_bitmap_size(const union bpf_attr *attr) > >> static struct bpf_map *dev_map_alloc(union bpf_attr *attr) > >> { > >> struct bpf_dtab *dtab; > >> - int err = -EINVAL; > >> + int err; > >> u64 cost; > > > > Perhaps keep the variables ordered longest to shortest? > > Is that a required coding standard? For networking code, yes. Just look around the files you're changing and see for yourself. > >> if (!capable(CAP_NET_ADMIN)) > >> diff --git a/kernel/bpf/xskmap.c b/kernel/bpf/xskmap.c > >> index 22066c28ba61..26859c6c9491 100644 > >> --- a/kernel/bpf/xskmap.c > >> +++ b/kernel/bpf/xskmap.c > >> @@ -17,7 +17,7 @@ struct xsk_map { > >> > >> static struct bpf_map *xsk_map_alloc(union bpf_attr *attr) > >> { > >> - int cpu, err = -EINVAL; > >> + int cpu, err; > >> struct xsk_map *m; > >> u64 cost; > > > > And here.