From: ebiederm@xmission.com (Eric W. Biederman)
To: David Miller <davem@davemloft.net>
Cc: kirill@shutemov.name, netdev@vger.kernel.org,
pablo@netfilter.org, ldv@altlinux.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netlink: fix gcc -Wconversion compilation warning
Date: Fri, 17 Dec 2010 22:58:01 -0800 [thread overview]
Message-ID: <m1oc8jlg92.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20101217.120234.59681524.davem@davemloft.net> (David Miller's message of "Fri, 17 Dec 2010 12:02:34 -0800 (PST)")
David Miller <davem@davemloft.net> writes:
> From: ebiederm@xmission.com (Eric W. Biederman)
> Date: Mon, 13 Dec 2010 13:35:25 -0800
>
>> "Kirill A. Shutsemov" <kirill@shutemov.name> writes:
>>
>>> From: Dmitry V. Levin <ldv@altlinux.org>
>>>
>>> $ cat << EOF | gcc -Wconversion -xc -S -o/dev/null -
>>> unsigned f(void) {return NLMSG_HDRLEN;}
>>> EOF
>>> <stdin>: In function 'f':
>>> <stdin>:3:26: warning: negative integer implicitly converted to unsigned type
>>>
>> This doesn't look like a bad fix, but I believe things will fail if
>> we give NLMSG_ALIGN an unsigned long like size_t. Say like sizeof.
>
> What are you talking about? That's exactly his test case,
> look at what NLMSG_HDRLEN is defined to, it's exactly the
> case you're worried "will fail", it passes sizeof() to
> NLMSG_ALIGN.
>
> I think I'll apply Kirill's original patch, it's good enough
> and simpler.
Probably. The case I was worried about was masks that become
0xffffffxx on 64bit instead of 0xffffffffffffxx. Especially
when mixing those with ints.
It is possible to get some really weird things.
Eric
prev parent reply other threads:[~2010-12-18 6:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 17:05 [PATCH] netlink: fix gcc -Wconversion compilation warning Kirill A. Shutsemov
2010-12-13 21:35 ` Eric W. Biederman
2010-12-14 11:27 ` Kirill A. Shutemov
2010-12-17 20:02 ` David Miller
2010-12-18 6:58 ` Eric W. Biederman [this message]
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=m1oc8jlg92.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=davem@davemloft.net \
--cc=kirill@shutemov.name \
--cc=ldv@altlinux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.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