qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] smbios: fix uuid copy
@ 2016-09-28 14:38 Marc-André Lureau
  2016-09-28 15:17 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2016-09-28 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, imammedo, famz, Marc-André Lureau

Since 9c5ce8db, the uuid is wrongly copied, as QemuUUID 'in' argument is
already a pointer.

Fixes ASAN complaining:
hw/smbios/smbios.c:489:5: runtime error: load of address 0x7fffcdb91b00 with insufficient space for an object of type '__int128 unsigned'

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/smbios/smbios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 9a6552a..3a96ced 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -486,7 +486,7 @@ static void smbios_build_type_0_table(void)
  */
 static void smbios_encode_uuid(struct smbios_uuid *uuid, QemuUUID *in)
 {
-    memcpy(uuid, &in, 16);
+    memcpy(uuid, in, 16);
     if (smbios_uuid_encoded) {
         uuid->time_low = bswap32(uuid->time_low);
         uuid->time_mid = bswap16(uuid->time_mid);
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] smbios: fix uuid copy
  2016-09-28 14:38 [Qemu-devel] [PATCH] smbios: fix uuid copy Marc-André Lureau
@ 2016-09-28 15:17 ` Laszlo Ersek
  2016-09-29  3:43   ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2016-09-28 15:17 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: imammedo, famz, mst

On 09/28/16 16:38, Marc-André Lureau wrote:
> Since 9c5ce8db, the uuid is wrongly copied, as QemuUUID 'in' argument is
> already a pointer.
> 
> Fixes ASAN complaining:
> hw/smbios/smbios.c:489:5: runtime error: load of address 0x7fffcdb91b00 with insufficient space for an object of type '__int128 unsigned'
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  hw/smbios/smbios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 9a6552a..3a96ced 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -486,7 +486,7 @@ static void smbios_build_type_0_table(void)
>   */
>  static void smbios_encode_uuid(struct smbios_uuid *uuid, QemuUUID *in)
>  {
> -    memcpy(uuid, &in, 16);
> +    memcpy(uuid, in, 16);
>      if (smbios_uuid_encoded) {
>          uuid->time_low = bswap32(uuid->time_low);
>          uuid->time_mid = bswap16(uuid->time_mid);
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Also, I think the "QemuUUID.fields" structure should be decorated with
QEMU_PACKED, for documentation purposes if nothing else. (Separate
question / patch, of course.)

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] smbios: fix uuid copy
  2016-09-28 15:17 ` Laszlo Ersek
@ 2016-09-29  3:43   ` Fam Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2016-09-29  3:43 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: Marc-André Lureau, qemu-devel, imammedo, mst

On Wed, 09/28 17:17, Laszlo Ersek wrote:
> On 09/28/16 16:38, Marc-André Lureau wrote:
> > Since 9c5ce8db, the uuid is wrongly copied, as QemuUUID 'in' argument is
> > already a pointer.
> > 
> > Fixes ASAN complaining:
> > hw/smbios/smbios.c:489:5: runtime error: load of address 0x7fffcdb91b00 with insufficient space for an object of type '__int128 unsigned'
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  hw/smbios/smbios.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> > index 9a6552a..3a96ced 100644
> > --- a/hw/smbios/smbios.c
> > +++ b/hw/smbios/smbios.c
> > @@ -486,7 +486,7 @@ static void smbios_build_type_0_table(void)
> >   */
> >  static void smbios_encode_uuid(struct smbios_uuid *uuid, QemuUUID *in)
> >  {
> > -    memcpy(uuid, &in, 16);
> > +    memcpy(uuid, in, 16);
> >      if (smbios_uuid_encoded) {
> >          uuid->time_low = bswap32(uuid->time_low);
> >          uuid->time_mid = bswap16(uuid->time_mid);
> > 
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> 
> Also, I think the "QemuUUID.fields" structure should be decorated with
> QEMU_PACKED, for documentation purposes if nothing else. (Separate
> question / patch, of course.)
> 
> Thanks
> Laszlo

Wrapped the long line in commit message and queued for next pull request,
thanks!

Fam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-29  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-28 14:38 [Qemu-devel] [PATCH] smbios: fix uuid copy Marc-André Lureau
2016-09-28 15:17 ` Laszlo Ersek
2016-09-29  3:43   ` Fam Zheng

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).