stringlist: fix division by zero
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
00dfde2742
commit
738c57eeaa
|
@ -87,8 +87,8 @@ void string_list_print_by_column(struct string_list *sl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
num = 80 / (len + 1);
|
num = 80 / (len + 1);
|
||||||
if (len == 0)
|
if (num == 0)
|
||||||
len = 1;
|
num = 1;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
list_for_each_entry(entry, &sl->list, list) {
|
list_for_each_entry(entry, &sl->list, list) {
|
||||||
|
|
Loading…
Reference in New Issue