linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: Build regressions/improvements in v3.3-rc5 (C lang questions)
Date: Tue, 28 Feb 2012 16:24:42 -0800	[thread overview]
Message-ID: <4F4D704A.7040508@xenotime.net> (raw)
In-Reply-To: <CA+55aFzzfuiu-ScRmRFYWDmrstYC4kvS0QQidBZsmjCpL_tkqw@mail.gmail.com>

On 02/28/2012 04:08 PM, Linus Torvalds wrote:

> On Tue, Feb 28, 2012 at 3:41 PM, Randy Dunlap <rdunlap@xenotime.net> wrote:
>>
>>>   + src/drivers/usb/misc/sisusbvga/sisusb.c: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t':  => 982
>>>   + src/fs/ecryptfs/miscdev.c: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t':  => 448, 488
>>
>> Do the (2) above mean that some platform's gcc is borked?
>> (I don't see these on i386 or x86_64.)
> 
> Hmm. We had something similar long ago on i386, where the kernel
> "size_t" was "unsigned long", but user-mode size_t was "unsigned int"
> (or maybe it was the other way around). Anyway, it's obviously
> physically the same type, but it would make gcc unhappy because gcc
> felt that somebody was doing something bad.
> 
>>>   + src/fs/ecryptfs/miscdev.c: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'unsigned int':  => 433, 433:60
>>
>> I can see that warning on 32-bit i386 (X86_32), but if I change the
>> "%lu" to "%u", it causes this warning on 64-bit x86_64:
>>
>> fs/ecryptfs/miscdev.c:433:38: warning: format '%u' expects type 'unsigned int', but argument 4 has type 'long unsigned int'
>>
>> so how is this supposed to be handled?
> 
> I suspect that one should be "%zu", because we have
> 
>   /* 4 + ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES comes from tag 65 packet format */
>   #define MAX_MSG_PKT_SIZE        (PKT_TYPE_SIZE + PKT_CTR_SIZE \
>                                  + ECRYPTFS_MAX_PKT_LEN_SIZE \
>                                  + sizeof(struct ecryptfs_message) \
>                                  + 4 + ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES)
> 
> so it's the "sizeof(struct ecryptfs_message)" that makes it a size_t
> (everything else is int, if I look at it right, and int+size_t is
> going to be size_t)
> 
> Of course, if the platform then has the compiler and the kernel
> disagreeing about size_t like above, that isn't going to help
> anything. But does it fix the x86-32/64 warnings?


Yes, it does fix both cases (and I should have tried that).
Thanks.

-- 

  reply	other threads:[~2012-02-29  0:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 20:50 Build regressions/improvements in v3.3-rc5 Geert Uytterhoeven
2012-02-28 23:41 ` Build regressions/improvements in v3.3-rc5 (C lang questions) Randy Dunlap
2012-02-29  0:08   ` Linus Torvalds
2012-02-29  0:24     ` Randy Dunlap [this message]
2012-02-29  0:31       ` [PATCH] ecryptfs: fix printk format warning for size_t Randy Dunlap

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=4F4D704A.7040508@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).