* [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 17:02 ` Colin King
0 siblings, 0 replies; 12+ messages in thread
From: Colin King @ 2019-06-03 17:02 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
Björn Töpel, Magnus Karlsson, netdev, xdp-newbies, bpf
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.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@canonical.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;
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 17:02 ` Colin King
0 siblings, 0 replies; 12+ messages in thread
From: Colin King @ 2019-06-03 17:02 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
Björn Töpel, Magnus Karlsson, netdev, xdp-newbies, bpf
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.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@canonical.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;
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
2019-06-03 17:02 ` Colin King
@ 2019-06-03 17:21 ` Jakub Kicinski
-1 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2019-06-03 17:21 UTC (permalink / raw)
To: Colin King
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
On Mon, 3 Jun 2019 18:02:47 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.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?
> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 17:21 ` Jakub Kicinski
0 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2019-06-03 17:21 UTC (permalink / raw)
To: Colin King
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
On Mon, 3 Jun 2019 18:02:47 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.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?
> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
2019-06-03 17:21 ` Jakub Kicinski
@ 2019-06-03 17:39 ` Colin Ian King
-1 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2019-06-03 17:39 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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?
>
>> 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.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 17:39 ` Colin Ian King
0 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2019-06-03 17:39 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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?
>
>> 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.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
2019-06-03 17:39 ` Colin Ian King
@ 2019-06-03 17:49 ` Jakub Kicinski
-1 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2019-06-03 17:49 UTC (permalink / raw)
To: Colin Ian King
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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.
> >> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 17:49 ` Jakub Kicinski
0 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2019-06-03 17:49 UTC (permalink / raw)
To: Colin Ian King
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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.
> >> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
2019-06-03 17:49 ` Jakub Kicinski
@ 2019-06-03 18:07 ` Colin Ian King
-1 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2019-06-03 18:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-03 18:07 ` Colin Ian King
0 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2019-06-03 18:07 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
Jesper Dangaard Brouer, John Fastabend, Björn Töpel,
Magnus Karlsson, netdev, xdp-newbies, bpf, kernel-janitors,
linux-kernel
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@canonical.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@canonical.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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
2019-06-03 18:07 ` Colin Ian King
@ 2019-06-06 10:44 ` Dan Carpenter
-1 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2019-06-06 10:44 UTC (permalink / raw)
To: Colin Ian King
Cc: Jakub Kicinski, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, Jesper Dangaard Brouer, John Fastabend,
Björn Töpel, Magnus Karlsson, netdev, xdp-newbies, bpf,
kernel-janitors, linux-kernel
On Mon, Jun 03, 2019 at 07:07:20PM +0100, Colin Ian King wrote:
> 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@canonical.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@canonical.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?
Everyone knows that netdev uses reverse Christmas tree declarations...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH][next] bpf: remove redundant assignment to err
@ 2019-06-06 10:44 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2019-06-06 10:44 UTC (permalink / raw)
To: Colin Ian King
Cc: Jakub Kicinski, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, Jesper Dangaard Brouer, John Fastabend,
Björn Töpel, Magnus Karlsson, netdev, xdp-newbies, bpf,
kernel-janitors, linux-kernel
On Mon, Jun 03, 2019 at 07:07:20PM +0100, Colin Ian King wrote:
> 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@canonical.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@canonical.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?
Everyone knows that netdev uses reverse Christmas tree declarations...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-06-06 10:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 17:02 [PATCH][next] bpf: remove redundant assignment to err Colin King
2019-06-03 17:02 ` Colin King
2019-06-03 17:21 ` Jakub Kicinski
2019-06-03 17:21 ` Jakub Kicinski
2019-06-03 17:39 ` Colin Ian King
2019-06-03 17:39 ` Colin Ian King
2019-06-03 17:49 ` Jakub Kicinski
2019-06-03 17:49 ` Jakub Kicinski
2019-06-03 18:07 ` Colin Ian King
2019-06-03 18:07 ` Colin Ian King
2019-06-06 10:44 ` Dan Carpenter
2019-06-06 10:44 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.