From: David Miller <davem@davemloft.net>
To: joe@perches.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: af_packet: Don't initialize vnet_hdr
Date: Thu, 12 May 2011 17:36:08 -0400 (EDT) [thread overview]
Message-ID: <20110512.173608.1652572492952866283.davem@davemloft.net> (raw)
In-Reply-To: <1305236000.6124.67.camel@Joe-Laptop>
From: Joe Perches <joe@perches.com>
Date: Thu, 12 May 2011 14:33:20 -0700
> On Thu, 2011-05-12 at 17:26 -0400, David Miller wrote:
>> From: Joe Perches <joe@perches.com>
>> Date: Thu, 12 May 2011 13:36:10 -0700
>>
>> > Save a memset, initialize only the portion necessary.
>> >
>> > packet_snd either gets this structure completely from
>> > memcpy_fromiovec or uses only the hdr_len set to 0,
>> > so don't always initialize the structure to 0.
>> >
>> > Signed-off-by: Joe Perches <joe@perches.com>
>>
>> On ARM this won't be tightly packed, therefore you'll leave
>> uninitialized pieces of padding in this structure and this
>> thing is an "on-the-wire" network header.
>>
>> I'm not applying this.
>
> I believe that it's only sent when po->has_vnet_hdr
> is set. In that case, it's completely filled from
> memcpy_fromiovec. In the not set po->has_vnet_hdr case,
> only vnet_hdr.hdr_len is accessed by packet_alloc_skb.
I think with the way this code is protecting accesses to vnet_hdr,
it's going to start warning that some parts "may" be use
uninitialized.
It's also slightly ugly to partially initialize these on-stack things.
I would rather see the code rearranged such that this sort of
hackish scheme isn't necessary.
Again, I'm not applying this.
next prev parent reply other threads:[~2011-05-12 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 20:36 [PATCH] net: af_packet: Don't initialize vnet_hdr Joe Perches
2011-05-12 21:26 ` David Miller
2011-05-12 21:33 ` Joe Perches
2011-05-12 21:36 ` David Miller [this message]
2011-05-12 21:55 ` Joe Perches
2011-05-12 21:59 ` David Miller
2011-05-12 23:25 ` [PATCH net-next V3] net: af_packet: Untangle packet_snd by adding vpacket_snd Joe Perches
2011-05-13 5:11 ` Eric Dumazet
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=20110512.173608.1652572492952866283.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).