mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roel Kluin <12o3l@tiscali.nl>
To: dbrownell@users.sourceforge.net
Cc: linux-usb@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] ehci-dbg: evaluate negative snprintf() retvals in qh_lines()
Date: Thu, 17 Apr 2008 19:56:13 +0200	[thread overview]
Message-ID: <48078F3D.80704@tiscali.nl> (raw)

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)

                 reply	other threads:[~2008-04-17 17:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48078F3D.80704@tiscali.nl \
    --to=12o3l@tiscali.nl \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome