From b8cfb2cd418a48aef822d25bc6eb627b9d954c7d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 15 Apr 2021 18:05:10 -0400 Subject: [PATCH] bgpd: fix uninit value when handling bgp read errs Compiler warns about uninitialized value, although in practice it is unreachable. Also updates a function comment explaining what that value does. Signed-off-by: Quentin Young --- bgpd/bgp_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index a696d95697..c2d8cae580 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -180,8 +180,8 @@ static int bgp_process_reads(struct thread *thread) bool more = true; // whether we got more data bool fatal = false; // whether fatal error occurred bool added_pkt = false; // whether we pushed onto ->ibuf + int code = 0; // FSM code if error occurred /* clang-format on */ - int code; peer = THREAD_ARG(thread); @@ -455,6 +455,9 @@ done : { /* * Reads a chunk of data from peer->fd into peer->ibuf_work. * + * code_p + * Pointer to location to store FSM event code in case of fatal error. + * * @return status flag (see top-of-file) */ static uint16_t bgp_read(struct peer *peer, int *code_p) -- 2.39.5