* [PATCH] lscpu: fix possibly undefined operation
@ 2012-04-23 8:43 Petr Uzel
2012-04-23 12:09 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Petr Uzel @ 2012-04-23 8:43 UTC (permalink / raw)
To: util-linux
With -Wall -Werror, compilation of lscpu.c fails with:
Making all in sys-utils
make[2]: Entering directory `/home/petr/upstream/util-linux/sys-utils'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -include ../config.h -I../include -DLOCALEDIR=\"/usr/share/locale\" -fsigned-char -Wall -Werror -MT lscpu.o -MD -MP -MF .deps/lscpu.Tpo -c -o lscpu.o lscpu.c
lscpu.c: In function ‘print_parsable’:
lscpu.c:971:7: error: operation on ‘p’ may be undefined [-Werror=sequence-point]
cc1: all warnings being treated as errors
Fix by splitting the pointer increment to separate statement.
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
sys-utils/lscpu.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 1c2d9b6..f4a06e6 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -967,8 +967,10 @@ print_parsable(struct lscpu_desc *desc, int cols[], int ncols,
*/
char *p = data + 1;
- while (p && *p != '\0')
- *p++ = tolower((unsigned int) *p);
+ while (p && *p != '\0') {
+ *p = tolower((unsigned int) *p);
+ p++;
+ }
}
fputs(data && *data ? data : "", stdout);
}
--
1.7.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lscpu: fix possibly undefined operation
2012-04-23 8:43 [PATCH] lscpu: fix possibly undefined operation Petr Uzel
@ 2012-04-23 12:09 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-04-23 12:09 UTC (permalink / raw)
To: Petr Uzel; +Cc: util-linux
On Mon, Apr 23, 2012 at 10:43:38AM +0200, Petr Uzel wrote:
> sys-utils/lscpu.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-23 12:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 8:43 [PATCH] lscpu: fix possibly undefined operation Petr Uzel
2012-04-23 12:09 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox