bpf: Remove unnecessary type castings
authorYu Zhe <yuzhe@nfschina.com>
Wed, 13 Apr 2022 01:50:48 +0000 (18:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 13 Apr 2022 23:02:24 +0000 (01:02 +0200)
Remove/clean up unnecessary void * type castings.

Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220413015048.12319-1-yuzhe@nfschina.com
kernel/bpf/bpf_struct_ops.c
kernel/bpf/hashtab.c

index 21069dbe9138f89a75e96b00391d33c66ee478d2..de01d37c2d3bb311f444824e5b1656d9b26fa02c 100644 (file)
@@ -263,7 +263,7 @@ int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, void *key,
        /* No lock is needed.  state and refcnt do not need
         * to be updated together under atomic context.
         */
-       uvalue = (struct bpf_struct_ops_value *)value;
+       uvalue = value;
        memcpy(uvalue, st_map->uvalue, map->value_size);
        uvalue->state = state;
        refcount_set(&uvalue->refcnt, refcount_read(&kvalue->refcnt));
@@ -353,7 +353,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key,
        if (err)
                return err;
 
-       uvalue = (struct bpf_struct_ops_value *)value;
+       uvalue = value;
        err = check_zero_holes(t, uvalue->data);
        if (err)
                return err;
index 65877967f414efc4b0d2986f8f022631ac55d1f7..c68fbebc8c0055b8c5113ce3dae8d7214622a626 100644 (file)
@@ -738,7 +738,7 @@ static void check_and_free_timer(struct bpf_htab *htab, struct htab_elem *elem)
  */
 static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node)
 {
-       struct bpf_htab *htab = (struct bpf_htab *)arg;
+       struct bpf_htab *htab = arg;
        struct htab_elem *l = NULL, *tgt_l;
        struct hlist_nulls_head *head;
        struct hlist_nulls_node *n;