bpf: remove redundant assignment to err
authorColin Ian King <colin.king@canonical.com>
Tue, 4 Jun 2019 08:21:46 +0000 (09:21 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 4 Jun 2019 14:57:07 +0000 (16:57 +0200)
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@canonical.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/devmap.c
kernel/bpf/xskmap.c

index 5ae7cce5ef16d00728dd9a0b3f69adbaeb9a8c2e..b58a33ca8a273dc870c8df63a6813522be495efe 100644 (file)
@@ -88,8 +88,8 @@ 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;
        u64 cost;
+       int err;
 
        if (!capable(CAP_NET_ADMIN))
                return ERR_PTR(-EPERM);
index 22066c28ba614a97ad5032dc9b4bbe0d603087e6..413d75f4fc726816a07bbd668c5420ab73b77d79 100644 (file)
@@ -17,8 +17,8 @@ struct xsk_map {
 
 static struct bpf_map *xsk_map_alloc(union bpf_attr *attr)
 {
-       int cpu, err = -EINVAL;
        struct xsk_map *m;
+       int cpu, err;
        u64 cost;
 
        if (!capable(CAP_NET_ADMIN))