lkml.org 
[lkml]   [2011]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] net: af_packet: Don't initialize vnet_hdr
From
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.


\
 
 \ /
  Last update: 2011-05-12 23:39    [W:0.066 / U:0.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog