* [Qemu-devel] [PATCH 0/2] slirp fixes
@ 2012-09-04 21:20 Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 1/2] slirp: Remove wrong type casts ins debug statements Stefan Weil
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stefan Weil @ 2012-09-04 21:20 UTC (permalink / raw)
To: Jan Kiszka; +Cc: peter.maydell, qemu-devel
These patches replace http://patchwork.ozlabs.org/patch/181411/.
I modified the code as suggested by Jan Kiska and separated
the original patch in two patches.
[PATCH 1/2] slirp: Remove wrong type casts ins debug statements
[PATCH 2/2] slirp: Fix error reported by static code analysis
Regards,
Stefan W.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/2] slirp: Remove wrong type casts ins debug statements
2012-09-04 21:20 [Qemu-devel] [PATCH 0/2] slirp fixes Stefan Weil
@ 2012-09-04 21:20 ` Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis Stefan Weil
2012-09-05 10:47 ` [Qemu-devel] [PATCH 0/2] slirp fixes Jan Kiszka
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2012-09-04 21:20 UTC (permalink / raw)
To: Jan Kiszka; +Cc: peter.maydell, qemu-devel, Stefan Weil
The type casts of pointers to long are not allowed
when sizeof(pointer) != sizeof(long).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
slirp/tcp_subr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 025b374..5890d7a 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -114,9 +114,9 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
int win = 0;
DEBUG_CALL("tcp_respond");
- DEBUG_ARG("tp = %lx", (long)tp);
- DEBUG_ARG("ti = %lx", (long)ti);
- DEBUG_ARG("m = %lx", (long)m);
+ DEBUG_ARG("tp = %p", tp);
+ DEBUG_ARG("ti = %p", ti);
+ DEBUG_ARG("m = %p", m);
DEBUG_ARG("ack = %u", ack);
DEBUG_ARG("seq = %u", seq);
DEBUG_ARG("flags = %x", flags);
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis
2012-09-04 21:20 [Qemu-devel] [PATCH 0/2] slirp fixes Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 1/2] slirp: Remove wrong type casts ins debug statements Stefan Weil
@ 2012-09-04 21:20 ` Stefan Weil
2012-09-05 10:47 ` Jan Kiszka
2012-09-05 10:47 ` [Qemu-devel] [PATCH 0/2] slirp fixes Jan Kiszka
2 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2012-09-04 21:20 UTC (permalink / raw)
To: Jan Kiszka; +Cc: peter.maydell, qemu-devel, Stefan Weil
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>
---
slirp/tcp_subr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 5890d7a..1542e43 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -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;
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] slirp fixes
2012-09-04 21:20 [Qemu-devel] [PATCH 0/2] slirp fixes Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 1/2] slirp: Remove wrong type casts ins debug statements Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis Stefan Weil
@ 2012-09-05 10:47 ` Jan Kiszka
2 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2012-09-05 10:47 UTC (permalink / raw)
To: Stefan Weil; +Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org
On 2012-09-04 23:20, Stefan Weil wrote:
> These patches replace http://patchwork.ozlabs.org/patch/181411/.
>
> I modified the code as suggested by Jan Kiska and separated
> the original patch in two patches.
>
> [PATCH 1/2] slirp: Remove wrong type casts ins debug statements
> [PATCH 2/2] slirp: Fix error reported by static code analysis
>
Thanks, applied to slirp queue. And I'll propose patch 2 for stable as well.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis
2012-09-04 21:20 ` [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis Stefan Weil
@ 2012-09-05 10:47 ` Jan Kiszka
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2012-09-05 10:47 UTC (permalink / raw)
To: Stefan Weil; +Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-stable
On 2012-09-04 23:20, Stefan Weil wrote:
> 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>
> ---
> slirp/tcp_subr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
> index 5890d7a..1542e43 100644
> --- a/slirp/tcp_subr.c
> +++ b/slirp/tcp_subr.c
> @@ -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;
>
I suppose this is also stable material, therefore extending CC.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-05 10:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 21:20 [Qemu-devel] [PATCH 0/2] slirp fixes Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 1/2] slirp: Remove wrong type casts ins debug statements Stefan Weil
2012-09-04 21:20 ` [Qemu-devel] [PATCH 2/2] slirp: Fix error reported by static code analysis Stefan Weil
2012-09-05 10:47 ` Jan Kiszka
2012-09-05 10:47 ` [Qemu-devel] [PATCH 0/2] slirp fixes Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).