From: Karel Zak Date: Mon, 7 Nov 2016 10:43:12 +0000 (+0100) Subject: lsmem: add Copyright X-Git-Tag: v2.30-rc1~418 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5c4535b0df9e122025d804b27831dc1d38c73a9;p=thirdparty%2Futil-linux.git lsmem: add Copyright Signed-off-by: Karel Zak --- diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c index cc681b84c4..14f5aa48d2 100644 --- a/sys-utils/chmem.c +++ b/sys-utils/chmem.c @@ -17,7 +17,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include #include #include @@ -78,6 +77,7 @@ static int chmem_size(struct chmem_desc *desc, int enable) size = desc->size; onoff = enable ? "online" : "offline"; i = enable ? 0 : desc->ndirs - 1; + for (; i >= 0 && i < desc->ndirs && size; i += enable ? 1 : -1) { name = desc->dirs[i]->d_name; index = strtou64_or_err(name + 6, _("Failed to parse index")); @@ -123,6 +123,7 @@ static int chmem_range(struct chmem_desc *desc, int enable) todo = desc->end - desc->start + 1; onoff = enable ? "online" : "offline"; + for (i = 0; i < desc->ndirs; i++) { name = desc->dirs[i]->d_name; index = strtou64_or_err(name + 6, _("Failed to parse index")); diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c index 1dcf8a8e40..2210339a3b 100644 --- a/sys-utils/lsmem.c +++ b/sys-utils/lsmem.c @@ -2,6 +2,7 @@ * lsmem - Show memory configuration * * Copyright IBM Corp. 2016 + * Copyright (C) 2016 Karel Zak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +18,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include #include #include