linux-um archives
 help / color / mirror / Atom feed
From: "Geyslan G. Bem" <geyslan@gmail.com>
To: jdike@addtoit.com
Cc: richard@nod.at, hwhilse@gmail.com,
	user-mode-linux-devel@lists.sourceforge.net,
	user-mode-linux-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, jg.victorino1@gmail.com,
	peter.senna@gmail.com, "Geyslan G. Bem" <geyslan@gmail.com>
Subject: [PATCH] um: fix returns without va_end
Date: Tue,  1 Dec 2015 17:18:55 -0300	[thread overview]
Message-ID: <1449001135-29980-1-git-send-email-geyslan@gmail.com> (raw)

When using va_list ensure that va_start will be followed by va_end.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 arch/um/drivers/net_user.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index e697a41..e9f8445 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -249,21 +249,23 @@ void close_addr(unsigned char *addr, unsigned char *netmask, void *arg)
 
 char *split_if_spec(char *str, ...)
 {
-	char **arg, *end;
+	char **arg, *end, *ret = NULL;
 	va_list ap;
 
 	va_start(ap, str);
 	while ((arg = va_arg(ap, char **)) != NULL) {
 		if (*str == '\0')
-			return NULL;
+			goto out;
 		end = strchr(str, ',');
 		if (end != str)
 			*arg = str;
 		if (end == NULL)
-			return NULL;
+			goto out;
 		*end++ = '\0';
 		str = end;
 	}
+	ret = str;
+out:
 	va_end(ap);
-	return str;
+	return ret;
 }
-- 
2.6.2


             reply	other threads:[~2015-12-01 20:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 20:18 Geyslan G. Bem [this message]
2015-12-08 21:32 ` [PATCH] um: fix returns without va_end Richard Weinberger

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=1449001135-29980-1-git-send-email-geyslan@gmail.com \
    --to=geyslan@gmail.com \
    --cc=hwhilse@gmail.com \
    --cc=jdike@addtoit.com \
    --cc=jg.victorino1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=user-mode-linux-user@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