linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ehci-dbg: evaluate negative snprintf() retvals in qh_lines()
@ 2008-04-17 17:56 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2008-04-17 17:56 UTC (permalink / raw)
  To: dbrownell; +Cc: linux-usb, lkml

Only when signed, a snprintf() retval below zero can be evaluated.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 64ebfc5..25a98c1 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -394,7 +394,7 @@ static void qh_lines (
 	u32			hw_curr;
 	struct list_head	*entry;
 	struct ehci_qtd		*td;
-	unsigned		temp;
+	int			temp;
 	unsigned		size = *sizep;
 	char			*next = *nextp;
 	char			mark;
@@ -459,9 +459,9 @@ static void qh_lines (
 		else if (size < temp)
 			temp = size;
 		size -= temp;
-		next += temp;
 		if (temp == size)
 			goto done;
+		next += temp;
 	}
 
 	temp = snprintf (next, size, "\n");
@@ -470,11 +470,10 @@ static void qh_lines (
 	else if (size < temp)
 		temp = size;
 	size -= temp;
-	next += temp;
 
 done:
 	*sizep = size;
-	*nextp = next;
+	*nextp = next + temp;
 }
 
 static ssize_t fill_async_buffer(struct debug_buffer *buf)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-17 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17 17:56 [PATCH] ehci-dbg: evaluate negative snprintf() retvals in qh_lines() Roel Kluin

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).