public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Kent Overstreet <kmo@daterainc.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-bcache@vger.kernel.org
Subject: Re: New bcache compiler warning (was: Re: bcache: Minor fixes from kbuild robot)
Date: Mon, 17 Feb 2014 13:06:52 -0800	[thread overview]
Message-ID: <530279EC.5010605@infradead.org> (raw)
In-Reply-To: <CAMuHMdUYZLv4X3VBEOgcf+Dr22Pi1xWx-6oMPX7usBk6HJHTMw@mail.gmail.com>

On 02/17/2014 01:00 PM, Geert Uytterhoeven wrote:
> On Fri, Feb 14, 2014 at 8:04 PM, Linux Kernel Mailing List
> <linux-kernel@vger.kernel.org> wrote:
>>    bcache: Minor fixes from kbuild robot
> 
>> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
>> index 4f6b594..3f74b4b 100644
>> --- a/drivers/md/bcache/bset.c
>> +++ b/drivers/md/bcache/bset.c
>> @@ -23,7 +23,7 @@ void bch_dump_bset(struct btree_keys *b, struct bset *i, unsigned set)
>>         for (k = i->start; k < bset_bkey_last(i); k = next) {
>>                 next = bkey_next(k);
>>
>> -               printk(KERN_ERR "block %u key %zi/%u: ", set,
>> +               printk(KERN_ERR "block %u key %li/%u: ", set,
>>                        (uint64_t *) k - i->d, i->keys);
>>
>>                 if (b->ops->key_dump)
> 
> On 32-bit (m68k):
> drivers/md/bcache/bset.c: In function ‘bch_dump_bset’:
> drivers/md/bcache/bset.c:27: warning: format ‘%li’ expects type ‘long
> int’, but argument 3 has type ‘int’
> 
> What are you trying to print here? It looks a bit strange to me.
> Technically, the difference between two pointers is of type ptrdiff_.
> The kernel had
> 
> typedef __kernel_ptrdiff_t      ptrdiff_t;
> 
> and
> 
> #if __BITS_PER_LONG != 64
> typedef unsigned int    __kernel_size_t;
> typedef int             __kernel_ssize_t;
> typedef int             __kernel_ptrdiff_t;
> #else
> typedef __kernel_ulong_t __kernel_size_t;
> typedef __kernel_long_t __kernel_ssize_t;
> typedef __kernel_long_t __kernel_ptrdiff_t;
> #endif
> 
> So I'd expect "%zi" to be the right way, and a quick test compile on
> 32-bit (m68k)
> and 64-bit (amd64) comfirms that. What was wrong with it?

The kernel supports 't' (%t) for ptrdiff_t (same as glibc),
so %ti should work (or %tu).

-- 
~Randy

  reply	other threads:[~2014-02-17 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 21:00 New bcache compiler warning (was: Re: bcache: Minor fixes from kbuild robot) Geert Uytterhoeven
2014-02-17 21:06 ` Randy Dunlap [this message]
2014-02-17 21:11   ` Geert Uytterhoeven
2014-02-17 21:45     ` Kent Overstreet
2014-02-17 22:44       ` Randy Dunlap
2014-02-17 22:46         ` Kent Overstreet
2014-02-18  9:01       ` Geert Uytterhoeven

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=530279EC.5010605@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=geert@linux-m68k.org \
    --cc=kmo@daterainc.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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