qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] two little build fixes
@ 2012-08-10 13:26 Gerd Hoffmann
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64) Gerd Hoffmann
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 2/2] scsi: fix warning Gerd Hoffmann
  0 siblings, 2 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2012-08-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

$subject says all.

cheers,
  Gerd

Gerd Hoffmann (2):
  avoid asprintf (not available on mingw)
  scsi: fix warning

 hw/msix.c     |    5 ++---
 hw/scsi-bus.c |    2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

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

* [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
  2012-08-10 13:26 [Qemu-devel] [PATCH 0/2] two little build fixes Gerd Hoffmann
@ 2012-08-10 13:26 ` Gerd Hoffmann
  2012-08-10 14:18   ` Markus Armbruster
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 2/2] scsi: fix warning Gerd Hoffmann
  1 sibling, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2012-08-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/msix.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index 800fc32..04345f2 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
         return -EINVAL;
     }
 
-    if (asprintf(&name, "%s-msix", dev->name) == -1) {
-        return -ENOMEM;
-    }
+    name = g_malloc(sizeof(dev->name) + 5);
+    snprintf(name, sizeof(dev->name) + 5, "%s-msix", dev->name);
 
     memory_region_init(&dev->msix_exclusive_bar, name, MSIX_EXCLUSIVE_BAR_SIZE);
 
-- 
1.7.1

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

* [Qemu-devel] [PATCH 2/2] scsi: fix warning
  2012-08-10 13:26 [Qemu-devel] [PATCH 0/2] two little build fixes Gerd Hoffmann
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64) Gerd Hoffmann
@ 2012-08-10 13:26 ` Gerd Hoffmann
  2012-08-10 13:51   ` Paolo Bonzini
  1 sibling, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2012-08-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

hw/scsi-bus.c:758: warning: ‘xfer’ may be used uninitialized in this
function

Isn't true, but older gcc versions (for example 4.1 as shipped in rhel5)
are not clever enougth to figure, so sprinkle in a default: line to make
them happy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/scsi-bus.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index b8a857d..4981a02 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -761,6 +761,7 @@ static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)
     switch (length) {
     case 0:
     case 3: /* USB-specific.  */
+    default:
         xfer = 0;
         break;
     case 1:
@@ -784,6 +785,7 @@ static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)
     switch (length) {
     case 0:
     case 3: /* USB-specific.  */
+    default:
         xfer = 0;
         break;
     case 1:
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH 2/2] scsi: fix warning
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 2/2] scsi: fix warning Gerd Hoffmann
@ 2012-08-10 13:51   ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2012-08-10 13:51 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

Il 10/08/2012 15:26, Gerd Hoffmann ha scritto:
> hw/scsi-bus.c:758: warning: ‘xfer’ may be used uninitialized in this
> function
> 
> Isn't true, but older gcc versions (for example 4.1 as shipped in rhel5)
> are not clever enougth to figure, so sprinkle in a default: line to make
> them happy.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/scsi-bus.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> index b8a857d..4981a02 100644
> --- a/hw/scsi-bus.c
> +++ b/hw/scsi-bus.c
> @@ -761,6 +761,7 @@ static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)
>      switch (length) {
>      case 0:
>      case 3: /* USB-specific.  */
> +    default:
>          xfer = 0;
>          break;
>      case 1:
> @@ -784,6 +785,7 @@ static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)
>      switch (length) {
>      case 0:
>      case 3: /* USB-specific.  */
> +    default:
>          xfer = 0;
>          break;
>      case 1:
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

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

* Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
  2012-08-10 13:26 ` [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64) Gerd Hoffmann
@ 2012-08-10 14:18   ` Markus Armbruster
  2012-08-12  9:54     ` Blue Swirl
  2012-08-13  5:46     ` Gerd Hoffmann
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Armbruster @ 2012-08-10 14:18 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

Gerd Hoffmann <kraxel@redhat.com> writes:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/msix.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 800fc32..04345f2 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
>          return -EINVAL;
>      }
>  
> -    if (asprintf(&name, "%s-msix", dev->name) == -1) {
> -        return -ENOMEM;
> -    }
> +    name = g_malloc(sizeof(dev->name) + 5);
> +    snprintf(name, sizeof(dev->name) + 5, "%s-msix", dev->name);
>  
>      memory_region_init(&dev->msix_exclusive_bar, name, MSIX_EXCLUSIVE_BAR_SIZE);

What about g_strdup_printf()?

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

* Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
  2012-08-10 14:18   ` Markus Armbruster
@ 2012-08-12  9:54     ` Blue Swirl
  2012-08-13  5:46     ` Gerd Hoffmann
  1 sibling, 0 replies; 7+ messages in thread
From: Blue Swirl @ 2012-08-12  9:54 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Gerd Hoffmann, qemu-devel

On Fri, Aug 10, 2012 at 2:18 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Gerd Hoffmann <kraxel@redhat.com> writes:
>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> ---
>>  hw/msix.c |    5 ++---
>>  1 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/msix.c b/hw/msix.c
>> index 800fc32..04345f2 100644
>> --- a/hw/msix.c
>> +++ b/hw/msix.c
>> @@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
>>          return -EINVAL;
>>      }
>>
>> -    if (asprintf(&name, "%s-msix", dev->name) == -1) {
>> -        return -ENOMEM;
>> -    }
>> +    name = g_malloc(sizeof(dev->name) + 5);
>> +    snprintf(name, sizeof(dev->name) + 5, "%s-msix", dev->name);
>>
>>      memory_region_init(&dev->msix_exclusive_bar, name, MSIX_EXCLUSIVE_BAR_SIZE);
>
> What about g_strdup_printf()?

+1

In either case, free() below needs to be changed to g_free().

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

* Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
  2012-08-10 14:18   ` Markus Armbruster
  2012-08-12  9:54     ` Blue Swirl
@ 2012-08-13  5:46     ` Gerd Hoffmann
  1 sibling, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2012-08-13  5:46 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On 08/10/12 16:18, Markus Armbruster wrote:
>> -    if (asprintf(&name, "%s-msix", dev->name) == -1) {
> 
> What about g_strdup_printf()?

Ah, nice.  Didn't know glib has this.

cheers,
  Gerd

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

end of thread, other threads:[~2012-08-13  5:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-10 13:26 [Qemu-devel] [PATCH 0/2] two little build fixes Gerd Hoffmann
2012-08-10 13:26 ` [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64) Gerd Hoffmann
2012-08-10 14:18   ` Markus Armbruster
2012-08-12  9:54     ` Blue Swirl
2012-08-13  5:46     ` Gerd Hoffmann
2012-08-10 13:26 ` [Qemu-devel] [PATCH 2/2] scsi: fix warning Gerd Hoffmann
2012-08-10 13:51   ` Paolo Bonzini

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