[RFC,2/5] tap: remove unnecessary bzero() calls in bpf api

Message ID 20240105222909.139674-3-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series BPF infrastructure enhancements |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 5, 2024, 10:28 p.m. UTC
  The structures are already fully initialized, bzero() or memset
is redundant.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/tap_bpf_api.c | 4 ----
 1 file changed, 4 deletions(-)
  

Patch

diff --git a/drivers/net/tap/tap_bpf_api.c b/drivers/net/tap/tap_bpf_api.c
index a6adec855dda..d176da0802eb 100644
--- a/drivers/net/tap/tap_bpf_api.c
+++ b/drivers/net/tap/tap_bpf_api.c
@@ -120,7 +120,6 @@  static int bpf_load(enum bpf_prog_type type,
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
 	attr.prog_type = type;
 	attr.insn_cnt = (__u32)insns_cnt;
 	attr.insns = ptr_to_u64(insns);
@@ -153,7 +152,6 @@  int tap_flow_bpf_rss_map_create(unsigned int key_size,
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
 	attr.map_type    = BPF_MAP_TYPE_HASH;
 	attr.key_size    = key_size;
 	attr.value_size  = value_size;
@@ -181,8 +179,6 @@  int tap_flow_bpf_update_rss_elem(int fd, void *key, void *value)
 {
 	union bpf_attr attr = {};
 
-	bzero(&attr, sizeof(attr));
-
 	attr.map_type = BPF_MAP_TYPE_HASH;
 	attr.map_fd = fd;
 	attr.key = ptr_to_u64(key);