From a9de0d5f6980ad29c3c9c8fb72bdb471c4aac123 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 10 Feb 2017 10:35:07 -0700 Subject: [PATCH] net/interface: check socket() return value Change-Id: I3abd1d2c98cda10acfb85abc221e294563843c07 Signed-off-by: Daniel Verkamp --- lib/net/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/net/interface.c b/lib/net/interface.c index 17218bbb3..db77f0e6e 100644 --- a/lib/net/interface.c +++ b/lib/net/interface.c @@ -345,6 +345,10 @@ static int netlink_addr_msg(uint32_t ifc_idx, uint32_t ip_address, uint32_t crea return -1; fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + if (fd < 0) { + SPDK_ERRLOG("socket failed!\n"); + return -1; + } /* setup local address & bind using this address. */ bzero(&la, sizeof(la));