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: <e351d18c-21cd-6617-2a59-31a48be54b7e@canonical.com>
Date:   Mon, 3 Jun 2019 19:07:20 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "David S . Miller" <davem@...emloft.net>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        Björn Töpel <bjorn.topel@...el.com>,
        Magnus Karlsson <magnus.karlsson@...el.com>,
        netdev@...r.kernel.org, xdp-newbies@...r.kernel.org,
        bpf@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] bpf: remove redundant assignment to err

On 03/06/2019 18:49, Jakub Kicinski wrote:
> 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 <colin.king@...onical.com>
>>>>
>>>> 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 <colin.king@...onical.com>
>>>> ---
>>>>  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.

Ah, informal coding standards. Great. Won't this end up with more diff
churn?

> 
>>>>  	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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ