Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933086AbbELOLp (ORCPT ); Tue, 12 May 2015 10:11:45 -0400 Received: from www.osadl.org ([62.245.132.105]:47130 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932991AbbELOLm (ORCPT ); Tue, 12 May 2015 10:11:42 -0400 From: Nicholas Mc Guire To: Jason Wessel Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] kdb; fix -Wsign-compare build warnings Date: Tue, 12 May 2015 16:03:27 +0200 Message-Id: <1431439407-15912-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2467 Lines: 63 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/