mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] vsprintf: fix gcc warning
Date: Mon, 7 Jul 2008 21:24:29 +0200	[thread overview]
Message-ID: <20080707192429.GA17551@damson.getinternet.no> (raw)

Hi :)

Does this look correct? Please disregard this if it has already
been fixed. Thanks.


Vegard

From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Mon, 7 Jul 2008 21:08:57 +0200
Subject: [PATCH] vsprintf: fix gcc warning

The patch

commit bf4bb495e5dc8f1abba98bb6cb08b2d94446a662
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sat Jul 5 22:37:13 2008 -0700

    printk: add support for '%pS'

introduced a new build warning from GCC (4.1.2):

  CC      lib/vsprintf.o
lib/vsprintf.c: In function `pointer':
lib/vsprintf.c:560: warning: cast from pointer to integer of different size

Whether the warning is useful or not is a discussion on its own. But
we can at least fix this by casting to 'unsigned long' instead of
'unsigned long long'. 'unsigned long' can hold a pointer and will be
converted implicitly to the right type upon calling the function.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 lib/vsprintf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index f60c7c0..39b6172 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -557,7 +557,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int base,
 		precision = 2*sizeof(void *);
 		type |= ZEROPAD;
 	}
-	return number(buf, end, (unsigned long long) ptr, base, size, precision, type);
+	return number(buf, end, (unsigned long) ptr, base, size, precision, type);
 }
 
 /**
-- 
1.5.4.1


             reply	other threads:[~2008-07-07 19:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 19:24 Vegard Nossum [this message]
2008-07-07 19:54 ` Linus Torvalds
2008-07-07 20:00   ` Vegard Nossum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080707192429.GA17551@damson.getinternet.no \
    --to=vegard.nossum@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®