linux-um archives
 help / color / mirror / Atom feed
From: David Binderman <dcb314@hotmail.com>
To: Jeff Dike <jdike@addtoit.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Richard Weinberger <richard@nod.at>,
	"user-mode-linux-devel@lists.sourceforge.net"
	<user-mode-linux-devel@lists.sourceforge.net>
Subject: RE: [uml-devel] linux-4.2-rc2/arch/um/drivers/net_user.c:258: possible missing call to va_end ?
Date: Mon, 13 Jul 2015 15:25:08 +0000	[thread overview]
Message-ID: <DUB128-W717989412EB0F37DA7D4F79C9C0@phx.gbl> (raw)
In-Reply-To: <20150713151341.GA4474@parts.user-mode-linux.org>


Hello there Jeff,

----------------------------------------
> Just eyeballing it, that looks right to me. It just needs your
> original bug report above the Signed-off-by.

Righto. Second try:

Hello there,

[linux-4.2-rc2/arch/um/drivers/net_user.c:258]: (error) va_list 'ap' was opened but not closed by va_end().

Source code is

    va_start(ap, str);
    while ((arg = va_arg(ap, char **)) != NULL) {
        if (*str == '\0')
            return NULL;
        end = strchr(str, ',');
        if (end != str)
            *arg = str;
        if (end == NULL)
            return NULL;
        *end++ = '\0';
        str = end;
    }
    va_end(ap);
    return str;

If va_end needs to be called for successful return, it probably also
needs to be called for NULL return (twice).

Regards

David Binderman

Signed-off-by: David Binderman <dcb314@hotmail.com>

--- linux-4.2-rc2/arch/um/drivers/net_user.c.sav    2015-07-13 15:41:33.2115
48852 +0100
+++ linux-4.2-rc2/arch/um/drivers/net_user.c    2015-07-13 15:42:50.191786525 +0
100
@@ -254,13 +254,17 @@ char *split_if_spec(char *str, ...)
 
     va_start(ap, str);
     while ((arg = va_arg(ap, char **)) != NULL) {
-        if (*str == '\0')
+        if (*str == '\0') {
+            va_end(ap);
             return NULL;
+        }
         end = strchr(str, ',');
         if (end != str)
             *arg = str;
-        if (end == NULL)
+        if (end == NULL) {
+            va_end(ap);
             return NULL;
+        }
         *end++ = '\0';
         str = end;
     }

 		 	   		  

  reply	other threads:[~2015-07-13 15:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  9:08 [uml-devel] linux-4.2-rc2/arch/um/drivers/net_user.c:258: possible missing call to va_end ? David Binderman
2015-07-13 11:49 ` Richard Weinberger
2015-07-13 12:52   ` David Binderman
2015-07-13 12:58     ` Geert Uytterhoeven
2015-07-13 13:07       ` Richard Weinberger
2015-07-13 14:57       ` David Binderman
2015-07-13 15:13         ` Jeff Dike
2015-07-13 15:25           ` David Binderman [this message]
2015-07-13 15:26         ` Geert Uytterhoeven
2015-07-13 15:40           ` Toralf Förster
2015-07-13 15:46             ` Geert Uytterhoeven
2015-07-13 15:56               ` Toralf Förster
2015-07-13 16:33           ` David Binderman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DUB128-W717989412EB0F37DA7D4F79C9C0@phx.gbl \
    --to=dcb314@hotmail.com \
    --cc=geert@linux-m68k.org \
    --cc=jdike@addtoit.com \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox