From: linux-os <linux-os@chaos.analogic.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: William Lee Irwin III <wli@holomorphy.com>, linux-kernel@vger.kernel.org
Subject: Re: [3/8] kill gen_init_cpio.c printk() of size_t warning
Date: Mon, 3 Jan 2005 17:03:24 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.61.0501031657530.15108@chaos.analogic.com> (raw)
In-Reply-To: <41D9BC07.8070209@zytor.com>
On Mon, 3 Jan 2005, H. Peter Anvin wrote:
> William Lee Irwin III wrote:
>>
>> On Mon, Jan 03, 2005 at 09:09:48PM +0000, H. Peter Anvin wrote:
>>
>>> Dear Wrongbot,
>>> Bullshit. Signed is promoted to unsigned.
>>
>> I'm not sure who you're responding to here, but gcc emitted an actual
>> warning and I was only attempting to carry out the minimal effort
>> necessary to silence it. I'm not really interested in creating or
>> being involved with controversy, just silencing the core build in the
>> least invasive and so on way possible, leaving deeper drivers/ issues
>> to the resolution of the true underlying problems.
>>
>> I don't have anything to do with the code excerpt above; I merely
>> followed the style of the other unsigned integer coercions in the file.
>>
>
> I was not responding to you, your stuff is perfectly sane.
>
> The claim from the Wrongbot was that "foo + 1" is bad when foo is a size_t.
> This is utter bullshit, since that's EXACTLY equivalent to:
>
> foo + (size_t)1
>
> ... because of promotion rules.
>
> -hpa
> -
I made no such claim. I claimed that the posted fix was wrong:
>
> Index: mm1-2.6.10/usr/gen_init_cpio.c
> ===================================================================
> --- mm1-2.6.10.orig/usr/gen_init_cpio.c 2005-01-03 06:45:53.000000000 -0800
> +++ mm1-2.6.10/usr/gen_init_cpio.c 2005-01-03 09:42:18.000000000 -0800
> @@ -112,7 +112,7 @@
> (long) gid, /* gid */
> 1, /* nlink */
> (long) mtime, /* mtime */
> - strlen(target) + 1, /* filesize */
> + (unsigned)strlen(target) + 1,/* filesize */
> 3, /* major */
> 1, /* minor */
> 0, /* rmajor */
> -
This is wrong because strlen() already returns a size_t (unsigned).
This "fix" only served to quiet the compiler which was warning
about the conversion. It is a "conversion", not a "promotion".
The simple fix to quiet this conversion warning is to use 1U
as previously shown.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
next prev parent reply other threads:[~2005-01-03 22:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-03 17:20 [0/8] patches vs. 2.6.10-mm1 William Lee Irwin III
2005-01-03 17:23 ` [1/8] there is no generic_file_(get|set)_policy() William Lee Irwin III
2005-01-03 17:26 ` [2/8] kill quota_v2.c printk() of size_t warning William Lee Irwin III
2005-01-03 17:28 ` [3/8] kill gen_init_cpio.c " William Lee Irwin III
2005-01-03 17:31 ` [4/8] fix arch/x86_64/ia32/syscall32.c misdeclared pud variable William Lee Irwin III
2005-01-03 17:34 ` William Lee Irwin III
2005-01-03 17:36 ` [5/8] silence numerous size_t warnings in drivers/acpi/processor_idle.c William Lee Irwin III
2005-01-03 17:39 ` [6/8] make IRDA string tables conditional on CONFIG_IRDA_DEBUG William Lee Irwin III
2005-01-03 17:45 ` [7/8] fix unresolved MTD symbols in scx200_docflash.c William Lee Irwin III
2005-01-03 17:47 ` [8/8] fix module_param() type mismatch in drivers/char/n_hdlc.c William Lee Irwin III
2005-01-03 18:11 ` William Lee Irwin III
2005-01-03 17:42 ` [3/8] kill gen_init_cpio.c printk() of size_t warning linux-os
2005-01-03 17:59 ` Jeff Garzik
2005-01-03 18:09 ` William Lee Irwin III
2005-01-03 18:33 ` linux-os
2005-01-03 21:09 ` H. Peter Anvin
2005-01-03 21:36 ` William Lee Irwin III
2005-01-03 21:41 ` H. Peter Anvin
2005-01-03 22:03 ` linux-os [this message]
2005-01-03 21:55 ` Al Viro
2005-01-03 22:09 ` William Lee Irwin III
2005-01-03 23:03 ` Ben Pfaff
2005-01-03 23:56 ` H. Peter Anvin
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=Pine.LNX.4.61.0501031657530.15108@chaos.analogic.com \
--to=linux-os@chaos.analogic.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=wli@holomorphy.com \
/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).