[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1431439407-15912-1-git-send-email-hofrat@osadl.org>
Date: Tue, 12 May 2015 16:03:27 +0200
From: Nicholas Mc Guire <hofrat@...dl.org>
To: Jason Wessel <jason.wessel@...driver.com>
Cc: kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] kdb; fix -Wsign-compare build warnings
change some local index variables, declared int, being
compared to ARRAY_SIZE() which is returning size_t, to size_t
(see c99 6.5.3.4 -4 and gcc-4.7 manual section 4.15).
Patch was compile tested with x86_64_defconfig + CONFIG_KGDB=y,
CONFIG_KGDB_KDB=y
Patch is against 4.1-rc3 (localversion-next is -next-20150512)
Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
---
The build warnings in kdb_support.c were:
kernel/debug/kdb/kdb_support.c: In function 'kdbnearsym':
kernel/debug/kdb/kdb_support.c:125:17: warning: comparison between signed
and unsigned integer expressions [-Wsign-compare]
kernel/debug/kdb/kdb_support.c:130:9: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
kernel/debug/kdb/kdb_support.c: In function 'kdbnearsym_cleanup':
kernel/debug/kdb/kdb_support.c:164:16: warning: comparison between signed
and unsigned integer expressions [-Wsign-compare]
kernel/debug/kdb/kdb_support.c: In function 'kdb_save_flags':
kernel/debug/kdb/kdb_support.c:919:2: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
the first 3 are fixed by this patch - the mismatch at line 919 is due
to negative index values being checked to detect imbalanced use of
kdb_save_flags()/kdb_restore_flags() - fixing it with a case is not really
helpful for readability so it is left as is.
kernel/debug/kdb/kdb_support.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
index 0bb3b81..a7f7e5c 100644
--- a/kernel/debug/kdb/kdb_support.c
+++ b/kernel/debug/kdb/kdb_support.c
@@ -110,7 +110,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab)
ret = symtab->sym_name != NULL && *(symtab->sym_name) != '\0';
if (ret) {
- int i;
+ size_t i;
/* Another 2.6 kallsyms "feature". Sometimes the sym_name is
* set but the buffer passed into kallsyms_lookup is not used,
* so it contains garbage. The caller has to work out which
@@ -160,7 +160,7 @@ out:
void kdbnearsym_cleanup(void)
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_SIZE(kdb_name_table); ++i) {
if (kdb_name_table[i]) {
debug_kfree(kdb_name_table[i]);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists