Blame 0176-slirp-Fix-error-reported-by-static-code-analysis.patch

5544c1
From b88c1cb2b263de9ffc3dcaa2822ef7b1fbd8575a Mon Sep 17 00:00:00 2001
5544c1
From: Stefan Weil <sw@weilnetz.de>
5544c1
Date: Tue, 4 Sep 2012 23:20:36 +0200
5544c1
Subject: [PATCH] slirp: Fix error reported by static code analysis
5544c1
5544c1
Report from smatch:
5544c1
5544c1
slirp/tcp_subr.c:127 tcp_respond(17) error:
5544c1
 we previously assumed 'tp' could be null (see line 124)
5544c1
5544c1
Return if 'tp' is NULL.
5544c1
5544c1
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
5544c1
(cherry picked from commit e56afbc54a2132c56931f44bae1992c28119944f)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 slirp/tcp_subr.c | 2 +-
5544c1
 1 file changed, 1 insertion(+), 1 deletion(-)
5544c1
5544c1
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
5544c1
index 5890d7a..1542e43 100644
5544c1
--- a/slirp/tcp_subr.c
5544c1
+++ b/slirp/tcp_subr.c
5544c1
@@ -124,7 +124,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
5544c1
 	if (tp)
5544c1
 		win = sbspace(&tp->t_socket->so_rcv);
5544c1
         if (m == NULL) {
5544c1
-		if ((m = m_get(tp->t_socket->slirp)) == NULL)
5544c1
+		if (!tp || (m = m_get(tp->t_socket->slirp)) == NULL)
5544c1
 			return;
5544c1
 		tlen = 0;
5544c1
 		m->m_data += IF_MAXLINKHDR;
5544c1
-- 
5544c1
1.7.12.1
5544c1