Hi,

The type of the local variable hash in pf_map_addr() has right length
but the wrong type.  This diff uses the correct type and removes the
useless casts.  Both functions uses hash as pf_addr, so no cast is
needed.

OK?

bye,
Jan

Index: net/pf_lb.c
===================================================================
RCS file: /cvs/src/sys/net/pf_lb.c,v
retrieving revision 1.67
diff -u -p -r1.67 pf_lb.c
--- net/pf_lb.c 29 Jul 2020 02:32:13 -0000      1.67
+++ net/pf_lb.c 12 Dec 2020 13:06:49 -0000
@@ -349,7 +349,7 @@ pf_map_addr(sa_family_t af, struct pf_ru
     struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_src_node **sns,
     struct pf_pool *rpool, enum pf_sn_types type)
 {
-       unsigned char            hash[16];
+       struct pf_addr           hash;
        struct pf_addr           faddr;
        struct pf_addr          *raddr = &rpool->addr.v.a.addr;
        struct pf_addr          *rmask = &rpool->addr.v.a.mask;
@@ -460,8 +460,7 @@ pf_map_addr(sa_family_t af, struct pf_ru
                }
                break;
        case PF_POOL_SRCHASH:
-               hashidx =
-                   pf_hash(saddr, (struct pf_addr *)&hash, &rpool->key, af);
+               hashidx = pf_hash(saddr, &hash, &rpool->key, af);
 
                if (rpool->addr.type == PF_ADDR_TABLE ||
                    rpool->addr.type == PF_ADDR_DYNIFTL) {
@@ -483,8 +482,7 @@ pf_map_addr(sa_family_t af, struct pf_ru
                                return (1);
                        pf_addrcpy(naddr, &rpool->counter, af);
                } else {
-                       pf_poolmask(naddr, raddr, rmask,
-                           (struct pf_addr *)&hash, af);
+                       pf_poolmask(naddr, raddr, rmask, &hash, af);
                }
                break;
        case PF_POOL_ROUNDROBIN:

Reply via email to