This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Account for alloca use when collecting interface addresses
- From: Andreas Schwab <schwab at suse dot de>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 25 Mar 2014 08:53:13 +0100
- Subject: Re: [PATCH] Account for alloca use when collecting interface addresses
- Authentication-results: sourceware.org; auth=none
- References: <mvm61n3puag dot fsf at hawking dot suse dot de> <Pine dot LNX dot 4 dot 64 dot 1403242117180 dot 1129 at digraph dot polyomino dot org dot uk>
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> I'm seeing compilation warnings (we clearly need to move to a -Werror
> default, I see a recent patch of mine introduced some as well...):
>
> ../sysdeps/unix/sysv/linux/check_pf.c:326:20: warning: 'in6ailist' may be used uninitialized in this function [-Wmaybe-uninitialized]
Thanks for catching that. This is embarrassing. I really need to
improve my testing, especially with the recent increase in warning spam.
How about this?
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Add out_fail2
label to be used after in6ailist is initialized.
---
sysdeps/unix/sysv/linux/check_pf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 6d8468d..e6a12ed 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -182,10 +182,10 @@ make_request (int fd, pid_t pid)
ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
if (read_len < 0)
- goto out_fail;
+ goto out_fail2;
if (msg.msg_flags & MSG_TRUNC)
- goto out_fail;
+ goto out_fail2;
struct nlmsghdr *nlmh;
for (nlmh = (struct nlmsghdr *) buf;
@@ -251,7 +251,7 @@ make_request (int fd, pid_t pid)
{
newp = malloc (sizeof (*newp));
if (newp == NULL)
- goto out_fail;
+ goto out_fail2;
newp->use_malloc = true;
}
newp->info.flags = (((ifam->ifa_flags
@@ -289,7 +289,7 @@ make_request (int fd, pid_t pid)
result = malloc (sizeof (*result)
+ in6ailistlen * sizeof (struct in6addrinfo));
if (result == NULL)
- goto out_fail;
+ goto out_fail2;
result->timestamp = get_nl_timestamp ();
result->usecnt = 2;
@@ -319,7 +319,7 @@ make_request (int fd, pid_t pid)
free (buf);
return result;
- out_fail:
+ out_fail2:
while (in6ailist != NULL)
{
struct in6ailist *next = in6ailist->next;
@@ -327,6 +327,7 @@ make_request (int fd, pid_t pid)
free (in6ailist);
in6ailist = next;
}
+ out_fail:
if (use_malloc)
free (buf);
return NULL;
--
1.9.1
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."