This is the mail archive of the
mailing list for the glibc project.
[Patch, MIPS] Fix uninitialized variable in inet/getnetgrent_r.c
- From: "Steve Ellcey " <sellcey at imgtec dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 10 Dec 2014 11:32:55 -0800
- Subject: [Patch, MIPS] Fix uninitialized variable in inet/getnetgrent_r.c
- Authentication-results: sourceware.org; auth=none
I got seven build failures on MIPS using the new -Werror flag. Here is a fix
for one of the build failures. I did get a good build with all these fixes but
I haven't done a complete testsuite run with these fixes. I hoping that this
fix is simple enough that building is a sufficient test.
The failure was:
getnetgrent_r.c: In function '__internal_getnetgrent_r':
getnetgrent_r.c:298:14: error: 'fct' may be used uninitialized in this function [-Werror=maybe-uninitialized]
status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno));
cc1: all warnings being treated as errors
I looked at the code and I don't think we can actually use an uninitialized
fct variable (due to the use of the no_more variable) but the compiler doesn't
seem to be able to figure that out. This fix is to just initialize fct to
OK to checkin?
2014-12-10 Steve Ellcey <firstname.lastname@example.org>
* inet/getnetgrent_r.c: Initialize fct.
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index e101537..4dc8eef 100644
@@ -268,7 +268,7 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
struct __netgrent *datap,
char *buffer, size_t buflen, int *errnop)
- enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *);
+ enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *) = NULL;
/* Initialize status to return if no more functions are found. */
enum nss_status status = NSS_STATUS_NOTFOUND;