All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free()
@ 2015-01-28 14:54 Markus Armbruster
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc() Markus Armbruster
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Markus Armbruster @ 2015-01-28 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

I'm routing these patches through qemu-trivial, even though some of
them touch actively maintained code, and could go through the
respective tree instead:

* PATCH 3 sPAPR (Alex)

* PATCH 4 USB (Gerd)

If you want me to reroute any of them, let me know.

Markus Armbruster (4):
  qemu-option: Replace pointless use of g_malloc0() by g_malloc()
  qemu-option: Pair g_malloc() with g_free(), not free()
  spapr_vio: Pair g_malloc() with g_free(), not free()
  usb: Pair g_malloc() with g_free(), not free()

 hw/ppc/spapr_vio.c | 2 +-
 hw/usb/desc-msos.c | 2 +-
 util/qemu-option.c | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
1.9.3

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

* [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
@ 2015-01-28 14:54 ` Markus Armbruster
  2015-01-29  0:20   ` Gonglei
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free() Markus Armbruster
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-01-28 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

get_opt_value() takes a write-only buffer, so zeroing it is pointless.
We don't do it elsewhere, either.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 util/qemu-option.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index a708241..c779150 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -213,7 +213,7 @@ void parse_option_size(const char *name, const char *value,
 bool has_help_option(const char *param)
 {
     size_t buflen = strlen(param) + 1;
-    char *buf = g_malloc0(buflen);
+    char *buf = g_malloc(buflen);
     const char *p = param;
     bool result = false;
 
@@ -237,7 +237,7 @@ out:
 bool is_valid_option_list(const char *param)
 {
     size_t buflen = strlen(param) + 1;
-    char *buf = g_malloc0(buflen);
+    char *buf = g_malloc(buflen);
     const char *p = param;
     bool result = true;
 
-- 
1.9.3

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

* [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc() Markus Armbruster
@ 2015-01-28 14:54 ` Markus Armbruster
  2015-01-29  0:20   ` Gonglei
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 3/4] spapr_vio: " Markus Armbruster
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-01-28 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
and my "coverity: Model g_free() isn't necessarily free()" model patch
applied.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 util/qemu-option.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index c779150..d3ab65d 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -230,7 +230,7 @@ bool has_help_option(const char *param)
     }
 
 out:
-    free(buf);
+    g_free(buf);
     return result;
 }
 
@@ -255,7 +255,7 @@ bool is_valid_option_list(const char *param)
     }
 
 out:
-    free(buf);
+    g_free(buf);
     return result;
 }
 
-- 
1.9.3

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

* [Qemu-devel] [PATCH 3/4] spapr_vio: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc() Markus Armbruster
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free() Markus Armbruster
@ 2015-01-28 14:54 ` Markus Armbruster
  2015-01-29  0:20   ` Gonglei
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 4/4] usb: " Markus Armbruster
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-01-28 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
and my "coverity: Model g_free() isn't necessarily free()" model patch
applied.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/ppc/spapr_vio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index dc9e46a..032ee1a 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -648,7 +648,7 @@ int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt)
 
     ret = 0;
 out:
-    free(qdevs);
+    g_free(qdevs);
 
     return ret;
 }
-- 
1.9.3

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

* [Qemu-devel] [PATCH 4/4] usb: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
                   ` (2 preceding siblings ...)
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 3/4] spapr_vio: " Markus Armbruster
@ 2015-01-28 14:54 ` Markus Armbruster
  2015-01-29  0:22   ` Gonglei
  2015-01-28 15:13 ` [Qemu-devel] [PATCH 0/4] " Eric Blake
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-01-28 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
and my "coverity: Model g_free() isn't necessarily free()" model patch
applied.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/usb/desc-msos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c
index 334d1ae..32c3600 100644
--- a/hw/usb/desc-msos.c
+++ b/hw/usb/desc-msos.c
@@ -231,7 +231,7 @@ int usb_desc_msos(const USBDesc *desc,  USBPacket *p,
         length = len;
     }
     memcpy(dest, buf, length);
-    free(buf);
+    g_free(buf);
 
     p->actual_length = length;
     return 0;
-- 
1.9.3

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

* Re: [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
                   ` (3 preceding siblings ...)
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 4/4] usb: " Markus Armbruster
@ 2015-01-28 15:13 ` Eric Blake
  2015-02-04  9:43 ` Markus Armbruster
  2015-02-07 13:30 ` Michael Tokarev
  6 siblings, 0 replies; 12+ messages in thread
From: Eric Blake @ 2015-01-28 15:13 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial

[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

On 01/28/2015 07:54 AM, Markus Armbruster wrote:
> I'm routing these patches through qemu-trivial, even though some of
> them touch actively maintained code, and could go through the
> respective tree instead:
> 
> * PATCH 3 sPAPR (Alex)
> 
> * PATCH 4 USB (Gerd)
> 
> If you want me to reroute any of them, let me know.

Reviewed-by: Eric Blake <eblake@redhat.com>

[for patches like these, sometimes I like to use git format-patch -U20
or whatever it takes to make the patch show full context of the
allocation a few lines earlier that matches with the actual g_free fix,
so that reviewers don't have to open the file themselves.  It makes for
larger emails, but potentially faster reviews.  But it's not the end of
the world to stick with the default 3-line context]

> 
> Markus Armbruster (4):
>   qemu-option: Replace pointless use of g_malloc0() by g_malloc()
>   qemu-option: Pair g_malloc() with g_free(), not free()
>   spapr_vio: Pair g_malloc() with g_free(), not free()
>   usb: Pair g_malloc() with g_free(), not free()
> 
>  hw/ppc/spapr_vio.c | 2 +-
>  hw/usb/desc-msos.c | 2 +-
>  util/qemu-option.c | 8 ++++----
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc()
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc() Markus Armbruster
@ 2015-01-29  0:20   ` Gonglei
  0 siblings, 0 replies; 12+ messages in thread
From: Gonglei @ 2015-01-29  0:20 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel

On 2015/1/28 22:54, Markus Armbruster wrote:

> get_opt_value() takes a write-only buffer, so zeroing it is pointless.
> We don't do it elsewhere, either.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  util/qemu-option.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

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

* Re: [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free() Markus Armbruster
@ 2015-01-29  0:20   ` Gonglei
  0 siblings, 0 replies; 12+ messages in thread
From: Gonglei @ 2015-01-29  0:20 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel

On 2015/1/28 22:54, Markus Armbruster wrote:

> Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
> and my "coverity: Model g_free() isn't necessarily free()" model patch
> applied.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  util/qemu-option.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

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

* Re: [Qemu-devel] [PATCH 3/4] spapr_vio: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 3/4] spapr_vio: " Markus Armbruster
@ 2015-01-29  0:20   ` Gonglei
  0 siblings, 0 replies; 12+ messages in thread
From: Gonglei @ 2015-01-29  0:20 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel

On 2015/1/28 22:54, Markus Armbruster wrote:

> Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
> and my "coverity: Model g_free() isn't necessarily free()" model patch
> applied.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/ppc/spapr_vio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

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

* Re: [Qemu-devel] [PATCH 4/4] usb: Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 ` [Qemu-devel] [PATCH 4/4] usb: " Markus Armbruster
@ 2015-01-29  0:22   ` Gonglei
  0 siblings, 0 replies; 12+ messages in thread
From: Gonglei @ 2015-01-29  0:22 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel

On 2015/1/28 22:54, Markus Armbruster wrote:

> Spotted by Coverity with preview checker ALLOC_FREE_MISMATCH enabled
> and my "coverity: Model g_free() isn't necessarily free()" model patch
> applied.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/usb/desc-msos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c
> index 334d1ae..32c3600 100644
> --- a/hw/usb/desc-msos.c
> +++ b/hw/usb/desc-msos.c
> @@ -231,7 +231,7 @@ int usb_desc_msos(const USBDesc *desc,  USBPacket *p,
>          length = len;
>      }
>      memcpy(dest, buf, length);
> -    free(buf);
> +    g_free(buf);
>  
>      p->actual_length = length;
>      return 0;

This patch had been added Gerd's usb queue :)

http://lists.gnu.org/archive/html/qemu-devel/2015-01/msg01998.html

Regards,
-Gonglei

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

* Re: [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
                   ` (4 preceding siblings ...)
  2015-01-28 15:13 ` [Qemu-devel] [PATCH 0/4] " Eric Blake
@ 2015-02-04  9:43 ` Markus Armbruster
  2015-02-07 13:30 ` Michael Tokarev
  6 siblings, 0 replies; 12+ messages in thread
From: Markus Armbruster @ 2015-02-04  9:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Got reviews, want qemu-trivial: *ping* :)

Markus Armbruster <armbru@redhat.com> writes:

> I'm routing these patches through qemu-trivial, even though some of
> them touch actively maintained code, and could go through the
> respective tree instead:
>
> * PATCH 3 sPAPR (Alex)
>
> * PATCH 4 USB (Gerd)
>
> If you want me to reroute any of them, let me know.
>
> Markus Armbruster (4):
>   qemu-option: Replace pointless use of g_malloc0() by g_malloc()
>   qemu-option: Pair g_malloc() with g_free(), not free()
>   spapr_vio: Pair g_malloc() with g_free(), not free()
>   usb: Pair g_malloc() with g_free(), not free()
>
>  hw/ppc/spapr_vio.c | 2 +-
>  hw/usb/desc-msos.c | 2 +-
>  util/qemu-option.c | 8 ++++----
>  3 files changed, 6 insertions(+), 6 deletions(-)

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

* Re: [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free()
  2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
                   ` (5 preceding siblings ...)
  2015-02-04  9:43 ` Markus Armbruster
@ 2015-02-07 13:30 ` Michael Tokarev
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Tokarev @ 2015-02-07 13:30 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial

28.01.2015 17:54, Markus Armbruster wrote:

> Markus Armbruster (4):
>   qemu-option: Replace pointless use of g_malloc0() by g_malloc()
>   qemu-option: Pair g_malloc() with g_free(), not free()
>   spapr_vio: Pair g_malloc() with g_free(), not free()
>   usb: Pair g_malloc() with g_free(), not free()

Applied to -trivial, thank you!

/mjt

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

end of thread, other threads:[~2015-02-07 13:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 14:54 [Qemu-devel] [PATCH 0/4] Pair g_malloc() with g_free(), not free() Markus Armbruster
2015-01-28 14:54 ` [Qemu-devel] [PATCH 1/4] qemu-option: Replace pointless use of g_malloc0() by g_malloc() Markus Armbruster
2015-01-29  0:20   ` Gonglei
2015-01-28 14:54 ` [Qemu-devel] [PATCH 2/4] qemu-option: Pair g_malloc() with g_free(), not free() Markus Armbruster
2015-01-29  0:20   ` Gonglei
2015-01-28 14:54 ` [Qemu-devel] [PATCH 3/4] spapr_vio: " Markus Armbruster
2015-01-29  0:20   ` Gonglei
2015-01-28 14:54 ` [Qemu-devel] [PATCH 4/4] usb: " Markus Armbruster
2015-01-29  0:22   ` Gonglei
2015-01-28 15:13 ` [Qemu-devel] [PATCH 0/4] " Eric Blake
2015-02-04  9:43 ` Markus Armbruster
2015-02-07 13:30 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.