Skip to content

Commit 8d6393c

Browse files
committed
bgpd: When creating extra from stack ensure it is zero'ed out
BGP code assumes that the extra data is zero'ed out. Ensure that we are not leaving any situation that the data on the stack is actually all 0's when we pass it around as a pointer later. Please note in issue #5025, Lou reported a different valgrind issue, which is not the same issue: ==7313== Conditional jump or move depends on uninitialised value(s) ==7313== at 0x181F9F: subgroup_announce_check (bgp_route.c:1555) ==7313== by 0x1A112B: subgroup_announce_table (bgp_updgrp_adv.c:641) ==7313== by 0x1A1340: subgroup_announce_route (bgp_updgrp_adv.c:704) ==7313== by 0x1A13E3: subgroup_coalesce_timer (bgp_updgrp_adv.c:331) ==7313== by 0x4EBA615: thread_call (thread.c:1531) ==7313== by 0x4E8AC37: frr_run (libfrr.c:1052) ==7313== by 0x1429E0: main (bgp_main.c:486) ==7313== ==7313== Conditional jump or move depends on uninitialised value(s) ==7313== at 0x201C0E: rfapi_vty_out_vncinfo (rfapi_vty.c:429) ==7313== by 0x18D0D6: route_vty_out (bgp_route.c:7481) ==7313== by 0x18DD76: bgp_show_table (bgp_route.c:9365) ==7313== by 0x1930C4: bgp_show_table_rd (bgp_route.c:9471) ==7313== by 0x1932A3: bgp_show (bgp_route.c:9510) ==7313== by 0x193E68: show_ip_bgp_json (bgp_route.c:10284) ==7313== by 0x4E6D024: cmd_execute_command_real.isra.2 (command.c:1072) ==7313== by 0x4E6F51E: cmd_execute_command (command.c:1131) ==7313== by 0x4E6F686: cmd_execute (command.c:1285) ==7313== by 0x4EBF9C4: vty_command (vty.c:516) ==7313== by 0x4EBFB9F: vty_execute (vty.c:1285) ==7313== by 0x4EC250F: vtysh_read (vty.c:2119) ==7313== that is causing the actual crash. Signed-off-by: Donald Sharp <[email protected]>
1 parent 21d5940 commit 8d6393c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bgpd/bgp_route.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1785,9 +1785,9 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
17851785

17861786
/* Route map & unsuppress-map apply. */
17871787
if (ROUTE_MAP_OUT_NAME(filter) || (pi->extra && pi->extra->suppress)) {
1788-
struct bgp_path_info rmap_path;
1789-
struct bgp_path_info_extra dummy_rmap_path_extra;
1790-
struct attr dummy_attr;
1788+
struct bgp_path_info rmap_path = {0};
1789+
struct bgp_path_info_extra dummy_rmap_path_extra = {0};
1790+
struct attr dummy_attr = {0};
17911791

17921792
memset(&rmap_path, 0, sizeof(struct bgp_path_info));
17931793
rmap_path.peer = peer;

bgpd/rfapi/rfapi_import.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2179,8 +2179,8 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
21792179
{
21802180
struct skiplist *sl;
21812181
int rc;
2182-
struct bgp_path_info bpi_fake;
2183-
struct bgp_path_info_extra bpi_extra;
2182+
struct bgp_path_info bpi_fake = {0};
2183+
struct bgp_path_info_extra bpi_extra = {0};
21842184
struct bgp_path_info *bpi_result;
21852185

21862186
sl = RFAPI_RDINDEX(rn);

0 commit comments

Comments
 (0)