[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] pv-grub: correct sizeof usage



Matthew Daley, le Sat 29 Mar 2014 18:08:08 +1300, a écrit :
> We were lucky that sizeof(frame) >= sizeof(*frame) anyway.

Ouch, indeed!

> Signed-off-by: Matthew Daley <mattd@xxxxxxxxxxx>

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  stubdom/grub/mini-os.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/stubdom/grub/mini-os.c b/stubdom/grub/mini-os.c
> index 64ab962..9d4bcc7 100644
> --- a/stubdom/grub/mini-os.c
> +++ b/stubdom/grub/mini-os.c
> @@ -333,7 +333,7 @@ struct frame {
>  static void minios_transmit (struct nic *nic, const char *d, unsigned int t,
>                               unsigned int s, const char *p)
>  {
> -    struct frame *frame = alloca(sizeof(frame) + s);
> +    struct frame *frame = alloca(sizeof(*frame) + s);
>  
>      memcpy(frame->dest, d, ETH_ALEN);
>      memcpy(frame->src, nic->node_addr, ETH_ALEN);
> -- 
> 1.9.0
> 

-- 
Samuel
<D> N: j'aime bien Cut d'un truc enorme... ca montre de quel cote de l'ecran 
sont les couilles :)))
 -+- #ens-mim et la peufeupeu -+-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.