From: Quentin Young Date: Thu, 15 Apr 2021 22:05:10 +0000 (-0400) Subject: bgpd: fix uninit value when handling bgp read errs X-Git-Tag: base_8.0~131^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b8cfb2cd418a48aef822d25bc6eb627b9d954c7d;p=matthieu%2Ffrr.git 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 --- 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)