Skip to content

Commit

Permalink
slirp: Fix error reported by static code analysis
Browse files Browse the repository at this point in the history
Report from smatch:

slirp/tcp_subr.c:127 tcp_respond(17) error:
 we previously assumed 'tp' could be null (see line 124)

Return if 'tp' is NULL.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit e56afbc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
stweil authored and mdroth committed Oct 12, 2012
1 parent 3ed791b commit 6116adb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slirp/tcp_subr.c
Expand Up @@ -124,7 +124,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
if (tp)
win = sbspace(&tp->t_socket->so_rcv);
if (m == NULL) {
if ((m = m_get(tp->t_socket->slirp)) == NULL)
if (!tp || (m = m_get(tp->t_socket->slirp)) == NULL)
return;
tlen = 0;
m->m_data += IF_MAXLINKHDR;
Expand Down

0 comments on commit 6116adb

Please sign in to comment.