l2tpd_packet: Fix compiler warnings

../../../src/l2tpd_packet.c: In function ‘l2tp_rcvmsg_control’:
../../../src/l2tpd_packet.c:586:26: error: ‘router_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  586 |    l2c->remote.router_id = router_id;
      |    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
../../../src/l2tpd_packet.c:577:25: note: ‘router_id’ was declared here
  577 |   uint32_t remote_ccid, router_id;
      |                         ^~~~~~~~~
../../../src/l2tpd_packet.c:582:20: error: ‘remote_ccid’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  582 |   l2c->remote.ccid = remote_ccid;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

Change-Id: I8d44ca64b2fc08184b40d16b90273c2a152ef00c
This commit is contained in:
Harald Welte 2020-05-03 21:27:39 +02:00
parent 19f433e2d5
commit 08bff6424e
1 changed files with 5 additions and 4 deletions

View File

@ -565,6 +565,7 @@ static int rx_scc_rq(struct l2tpd_connection *l2c, struct msgb *msg, struct avps
struct sockaddr *sockaddr = msg->dst;
char *host_name = NULL;
uint16_t pw;
int rc;
/* Abort if Pseudowire capability doesn't include 6(HDLC) */
if (avpp_val_u16(ap, VENDOR_IETF, AVP_IETF_PW_CAP_LIST, &pw) < 0 ||
@ -577,12 +578,12 @@ static int rx_scc_rq(struct l2tpd_connection *l2c, struct msgb *msg, struct avps
uint32_t remote_ccid, router_id;
l2c = l2tpd_cc_alloc(l2i);
/* Get Assigned CCID and store in l2cc->remote.ccid */
avpp_val_u32(ap, VENDOR_IETF, AVP_IETF_AS_CTRL_CON_ID,
&remote_ccid);
rc = avpp_val_u32(ap, VENDOR_IETF, AVP_IETF_AS_CTRL_CON_ID, &remote_ccid);
OSMO_ASSERT(rc == 0);
l2c->remote.ccid = remote_ccid;
/* Router ID AVP */
if (avpp_val_u32(ap, VENDOR_IETF, AVP_IETF_ROUTER_ID,
&router_id))
rc = avpp_val_u32(ap, VENDOR_IETF, AVP_IETF_ROUTER_ID, &router_id);
if (rc == 0)
l2c->remote.router_id = router_id;
/* Host Name AVP */
host_name = (char *) avpp_val(ap, VENDOR_IETF, AVP_IETF_HOST_NAME);