qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch
@ 2012-08-24  5:03 Stefan Weil
  2012-08-24 11:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2012-08-24 13:48 ` [Qemu-devel] " Luiz Capitulino
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-08-24  5:03 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Stefan Weil, Anthony Liguori, qemu-devel

Clang reports this warning:

Null pointer passed as an argument to a 'nonnull' parameter

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 qemu-ga.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qemu-ga.c b/qemu-ga.c
index 26671fe..7623079 100644
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -438,7 +438,9 @@ static void become_daemon(const char *pidfile)
     return;
 
 fail:
-    unlink(pidfile);
+    if (pidfile) {
+        unlink(pidfile);
+    }
     g_critical("failed to daemonize");
     exit(EXIT_FAILURE);
 #endif
-- 
1.7.10

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch
  2012-08-24  5:03 [Qemu-devel] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch Stefan Weil
@ 2012-08-24 11:29 ` Stefan Hajnoczi
  2012-08-24 13:48 ` [Qemu-devel] " Luiz Capitulino
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-08-24 11:29 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

On Fri, Aug 24, 2012 at 07:03:03AM +0200, Stefan Weil wrote:
> Clang reports this warning:
> 
> Null pointer passed as an argument to a 'nonnull' parameter
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  qemu-ga.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Nice, this looks like a legitimate bug that was detected by clang.  We
call become_daemon(NULL).

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

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

* Re: [Qemu-devel] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch
  2012-08-24  5:03 [Qemu-devel] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch Stefan Weil
  2012-08-24 11:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
@ 2012-08-24 13:48 ` Luiz Capitulino
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Capitulino @ 2012-08-24 13:48 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Anthony Liguori, qemu-devel

On Fri, 24 Aug 2012 07:03:03 +0200
Stefan Weil <sw@weilnetz.de> wrote:

> Clang reports this warning:
> 
> Null pointer passed as an argument to a 'nonnull' parameter
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>

> ---
>  qemu-ga.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-ga.c b/qemu-ga.c
> index 26671fe..7623079 100644
> --- a/qemu-ga.c
> +++ b/qemu-ga.c
> @@ -438,7 +438,9 @@ static void become_daemon(const char *pidfile)
>      return;
>  
>  fail:
> -    unlink(pidfile);
> +    if (pidfile) {
> +        unlink(pidfile);
> +    }
>      g_critical("failed to daemonize");
>      exit(EXIT_FAILURE);
>  #endif

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24  5:03 [Qemu-devel] [PATCH for 1.2] qemu-ga: Fix null pointer passed to unlink in failure branch Stefan Weil
2012-08-24 11:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-08-24 13:48 ` [Qemu-devel] " Luiz Capitulino

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