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

Re: [Xen-devel] [PATCH 2/2] xenpmd: make 32 bit gcc 8.1 non-debug build work



Wei Liu writes ("[PATCH 2/2] xenpmd: make 32 bit gcc 8.1 non-debug build work"):
> 32 bit gcc 8.1 non-debug build yields:
...
>      /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators */
> -    snprintf(val, 3, "%02x", 
> -             (unsigned int)(9*4 +
> -                            strlen(info->model_number) +
> -                            strlen(info->serial_number) +
> -                            strlen(info->battery_type) +
> -                            strlen(info->oem_info) + 4));

This is pretty unpleasant!

> +    len = 9 * 4 + strlen(info->model_number) + strlen(info->serial_number) +
> +          strlen(info->battery_type) + strlen(info->oem_info) + 4;
> +    assert(len < 255);
> +    snprintf(val, 3, "%02x", len);

This is slightly less unpleasant, I guess...

Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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