diff mbox series

[next] bpf: devmap: remove redundant assignment of variable drops

Message ID 20210527143637.795393-1-colin.king@canonical.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series [next] bpf: devmap: remove redundant assignment of variable drops | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Colin King May 27, 2021, 2:36 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable drops is being assigned a value that is never
read, it is being updated 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 --
 1 file changed, 2 deletions(-)

Comments

Fijalkowski, Maciej May 27, 2021, 2:55 p.m. UTC | #1
On Thu, May 27, 2021 at 03:36:37PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable drops is being assigned a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed.

Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

Would help if you would have CCed me given the fact that hour ago I
confirmed that it could be removed :p but no big deal.

Thanks!

> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  kernel/bpf/devmap.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index f9148daab0e3..fe3873b5d13d 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -388,8 +388,6 @@ static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
>  		to_send = dev_map_bpf_prog_run(bq->xdp_prog, bq->q, cnt, dev);
>  		if (!to_send)
>  			goto out;
> -
> -		drops = cnt - to_send;
>  	}
>  
>  	sent = dev->netdev_ops->ndo_xdp_xmit(dev, to_send, bq->q, flags);
> -- 
> 2.31.1
>
Daniel Borkmann May 28, 2021, 8:21 p.m. UTC | #2
On 5/27/21 4:55 PM, Maciej Fijalkowski wrote:
> On Thu, May 27, 2021 at 03:36:37PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The variable drops is being assigned a value that is never
>> read, it is being updated later on. The assignment is redundant and
>> can be removed.
> 
> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> 
> Would help if you would have CCed me given the fact that hour ago I
> confirmed that it could be removed :p but no big deal.

Thanks guys, fyi, took in this one for bpf-next [0], since more unneeded
code removed.

   [0] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=e8e0f0f484780d7b90a63ea50020ac4bb027178d

>> Addresses-Coverity: ("Unused value")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   kernel/bpf/devmap.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
>> index f9148daab0e3..fe3873b5d13d 100644
>> --- a/kernel/bpf/devmap.c
>> +++ b/kernel/bpf/devmap.c
>> @@ -388,8 +388,6 @@ static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
>>   		to_send = dev_map_bpf_prog_run(bq->xdp_prog, bq->q, cnt, dev);
>>   		if (!to_send)
>>   			goto out;
>> -
>> -		drops = cnt - to_send;
>>   	}
>>   
>>   	sent = dev->netdev_ops->ndo_xdp_xmit(dev, to_send, bq->q, flags);
>> -- 
>> 2.31.1
>>
diff mbox series

Patch

diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index f9148daab0e3..fe3873b5d13d 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -388,8 +388,6 @@  static void bq_xmit_all(struct xdp_dev_bulk_queue *bq, u32 flags)
 		to_send = dev_map_bpf_prog_run(bq->xdp_prog, bq->q, cnt, dev);
 		if (!to_send)
 			goto out;
-
-		drops = cnt - to_send;
 	}
 
 	sent = dev->netdev_ops->ndo_xdp_xmit(dev, to_send, bq->q, flags);