[19623] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: On AIX with GCC 6.3.0, a "maybe-unitialized" variable generates

daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Aug 23 11:14:35 2017

To: "REIX, Tony" <tony.reix@atos.net>, "krbdev@mit.edu" <krbdev@mit.edu>
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <fe926439-6856-6803-794c-9005bb70c5af@mit.edu>
Date: Wed, 23 Aug 2017 11:14:21 -0400
MIME-Version: 1.0
In-Reply-To: <B37989F2852398498001550C29155BE5178BBADC@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu

On 08/23/2017 09:28 AM, REIX, Tony wrote:
> On AIX with GCC 6.3.0, a "maybe-unitialized" variable generates an error.

> localaddr.c:1033:9: error: 'n' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>         for (i = 0; i + sizeof(struct ifreq) <= n; i+= ifreq_size(*ifr) ) {

It looks like n is supposed to be set by get_ifreq_array(), but this
particular version of gcc isn't smart enough to determine that
get_ifreq_array() always either sets *np or returns nonzero, perhaps
because of the case at line 892 where errno is used as a return value.
My preferred fix for this sort of problem is to make get_ifreq_array()
begin with:

    *bufp = NULL;
    *np = 0;

Does that make the error go away?

Thanks.

(As a side note, if you are comfortable using github, you could file
these patches as pull requests against https://github.com/krb5/krb5 .
Otherwise I will take care of filing PRs.)
_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

home help back first fref pref prev next nref lref last post