From: Steffen Klassert
> Sent: 03 April 2017 09:16
> All available gso_type flags are currently in use, so
> extend gso_type from 'unsigned short' to 'unsigned int'
> to be able to add further flags.
> 
> We also reorder the struct skb_shared_info to use
> two bytes of the four byte hole before dataref.
> All fields before _unused are cleared now, i.e.
> two bytes more than before the change.
...
> -      * Warning : all fields before dataref are cleared in __alloc_skb()
> +      * Warning : all fields before _unused are cleared in __alloc_skb()
>        */
> +     unsigned short  _unused;
>       atomic_t        dataref;
> 
>       /* Intermediate layers must ensure that destructor_arg
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 9f78109..8796b93 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -257,7 +257,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t 
> gfp_mask,
> 
>       /* make sure we initialize shinfo sequentially */
>       shinfo = skb_shinfo(skb);
> -     memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
> +     memset(shinfo, 0, offsetof(struct skb_shared_info, _unused));
>       atomic_set(&shinfo->dataref, 1);
>       kmemcheck_annotate_variable(shinfo->destructor_arg);

Is it worth adding a specific field name for the end of the 'zero' area?
Either as a #define or anonymous union.

I think that changing the definition to:
        union {
                unsigned short  _unused;
                atomic_t        dataref;
        };
would require no other changes.

        David


Reply via email to