]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pbrd: initialize structs used in hash_lookup
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 22 Jan 2025 10:16:10 +0000 (11:16 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 11 Feb 2025 08:50:25 +0000 (09:50 +0100)
Doesn't seem to break anything but really poor style to pass potentially
uninitialized data to hash_lookup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit c88589f5e9351654c04322eb395003297656989d)

pbrd/pbr_nht.c
pbrd/pbr_vty.c

index cbff4832a4ead2cf55b9ff1b2e2ad0b96c79c95c..ec6ebb4c200db6abf98ecf9c87c2c6f10fe43977 100644 (file)
@@ -502,7 +502,7 @@ void pbr_nht_change_group(const char *name)
        }
 
        for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
-               struct pbr_nexthop_cache lookup;
+               struct pbr_nexthop_cache lookup = {};
                struct pbr_nexthop_cache *pnhc;
 
                lookup.nexthop = *nhop;
@@ -571,7 +571,7 @@ void pbr_nht_add_individual_nexthop(struct pbr_map_sequence *pbrms,
        struct pbr_nexthop_group_cache *pnhgc;
        struct pbr_nexthop_group_cache find;
        struct pbr_nexthop_cache *pnhc;
-       struct pbr_nexthop_cache lookup;
+       struct pbr_nexthop_cache lookup = {};
        struct nexthop *nh;
        char buf[PBR_NHC_NAMELEN];
 
@@ -629,7 +629,7 @@ static void pbr_nht_release_individual_nexthop(struct pbr_map_sequence *pbrms)
        struct pbr_nexthop_group_cache *pnhgc;
        struct pbr_nexthop_group_cache find;
        struct pbr_nexthop_cache *pnhc;
-       struct pbr_nexthop_cache lup;
+       struct pbr_nexthop_cache lup = {};
        struct nexthop *nh;
        enum nexthop_types_t nh_type = 0;
 
@@ -687,7 +687,7 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name)
        DEBUGD(&pbr_dbg_nht, "%s: Retrieved NHGC @ %p", __func__, pnhgc);
 
        for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
-               struct pbr_nexthop_cache lookupc;
+               struct pbr_nexthop_cache lookupc = {};
                struct pbr_nexthop_cache *pnhc;
 
                lookupc.nexthop = *nhop;
index 60e215e731ef3bcb0e031430e1ab62fee3b953ec..40e5a7af03c5f66c1beeadba063d7a09661c7546 100644 (file)
@@ -854,7 +854,7 @@ pbrms_nexthop_group_write_individual_nexthop(
 {
        struct pbr_nexthop_group_cache find;
        struct pbr_nexthop_group_cache *pnhgc;
-       struct pbr_nexthop_cache lookup;
+       struct pbr_nexthop_cache lookup = {};
        struct pbr_nexthop_cache *pnhc;
 
        memset(&find, 0, sizeof(find));