From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] stringlist: fix division by zero
Date: Tue, 28 Aug 2012 17:24:26 +0200 [thread overview]
Message-ID: <1346167466-10098-2-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <1346167466-10098-1-git-send-email-eric@eukrea.com>
len is checked instead of num so when num is zero, we get a
division by zero a few lines later
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
lib/stringlist.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/stringlist.c b/lib/stringlist.c
index b965aa0..a8af15d 100644
--- a/lib/stringlist.c
+++ b/lib/stringlist.c
@@ -87,8 +87,8 @@ void string_list_print_by_column(struct string_list *sl)
return;
num = 80 / (len + 1);
- if (len == 0)
- len = 1;
+ if (num == 0)
+ num = 1;
i = 0;
list_for_each_entry(entry, &sl->list, list) {
--
1.7.7.6
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-08-28 15:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 15:24 [PATCH 1/2] usb_hub_power_on: wait for the power to be stable Eric Bénard
2012-08-28 15:24 ` Eric Bénard [this message]
2012-08-29 7:10 ` [PATCH 2/2] stringlist: fix division by zero Sascha Hauer
2012-08-28 15:30 ` [PATCH 1/2] usb_hub_power_on: wait for the power to be stable Eric Bénard
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=1346167466-10098-2-git-send-email-eric@eukrea.com \
--to=eric@eukrea.com \
--cc=barebox@lists.infradead.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