mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genksyms: Use same type in loop comparison
@ 2011-07-11 22:32 Jesper Juhl
  2011-07-25 12:58 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-07-11 22:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sam Ravnborg, Michal Marek, Richard Henderson, Bjorn Ekwall, trivial

The ARRAY_SIZE macro in scripts/genksyms/genksyms.c returns a value of
type size_t. That value is being compared to a variable of type int in
a loop in read_node(). Change the int variable to size_t type as well,
so we don't do signed vs unsigned type comparisons with all the
potential promotion/sign extension trouble that can cause (also
silences compiler warnings at high levels of warnings).

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 scripts/genksyms/genksyms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index f9e7553..6d3fda0 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -448,7 +448,7 @@ static struct string_list *read_node(FILE *f)
 	node.string = buffer;
 
 	if (node.string[1] == '#') {
-		int n;
+		size_t n;
 
 		for (n = 0; n < ARRAY_SIZE(symbol_types); n++) {
 			if (node.string[0] == symbol_types[n].n) {
-- 
1.7.6


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] genksyms: Use same type in loop comparison
  2011-07-11 22:32 [PATCH] genksyms: Use same type in loop comparison Jesper Juhl
@ 2011-07-25 12:58 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2011-07-25 12:58 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-kernel, Sam Ravnborg, Richard Henderson, Bjorn Ekwall, trivial

On Tue, Jul 12, 2011 at 12:32:04AM +0200, Jesper Juhl wrote:
> The ARRAY_SIZE macro in scripts/genksyms/genksyms.c returns a value of
> type size_t. That value is being compared to a variable of type int in
> a loop in read_node(). Change the int variable to size_t type as well,
> so we don't do signed vs unsigned type comparisons with all the
> potential promotion/sign extension trouble that can cause (also
> silences compiler warnings at high levels of warnings).
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied to kbuid-2.6.git#kbuild, thanks.

Michal

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-25 12:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 22:32 [PATCH] genksyms: Use same type in loop comparison Jesper Juhl
2011-07-25 12:58 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®