[19624] 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 (REIX, Tony)
Wed Aug 23 11:31:37 2017

From: "REIX, Tony" <tony.reix@atos.net>
To: Greg Hudson <ghudson@mit.edu>, "krbdev@mit.edu" <krbdev@mit.edu>
Date: Wed, 23 Aug 2017 15:31:24 +0000
Message-ID: <B37989F2852398498001550C29155BE5178BBB28@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
In-Reply-To: <fe926439-6856-6803-794c-9005bb70c5af@mit.edu>
Content-Language: fr-FR
Content-Type: multipart/mixed;
	boundary="_002_B37989F2852398498001550C29155BE5178BBB28FRCRPVV9EX3MSXw_"
MIME-Version: 1.0
Errors-To: krbdev-bounces@mit.edu

--_002_B37989F2852398498001550C29155BE5178BBB28FRCRPVV9EX3MSXw_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Greg,=0A=
=0A=
Thanks for the alternative patch.=0A=
I've tested it. That's perfect.=0A=
I've attached the new patch to this email.=0A=
=0A=
I was comfortable with github. No more. So please fill PRs.=0A=
=0A=
BTW, here are the warnings I see still with localaddr.c .=0A=
That does not block me. However that may show some hidden issue. But I have=
 very very small knowledge of krb5. Just porting it.=0A=
=0A=
gcc -maix64 -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -DH=
AVE_CONFIG_H -DLIBDIR=3D\"/opt/freeware/lib64\" -DBINDIR=3D\"/opt/freeware/=
bin\" -DSBINDIR=3D\"/opt/freeware/sbin\" -I../../../include -I../../../incl=
ude -I../../../util/profile -DKRB5_DEPRECATED=3D1 -DKRB5_PRIVATE  -DSYSV -D=
_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX53 -D_AIX61 -D_AIX71 -D_AIX7=
2 -D_ALL_SOURCE -DFUNCPROTO=3D15 -O -I/opt/freeware/include -D_THREAD_SAFE =
 -Wall -Wcast-align -Wshadow -Wmissing-prototypes -pedantic -Wno-format-zer=
o-length -Woverflow -Wstrict-overflow -Wmissing-format-attribute -Wmissing-=
prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-f=
unction -Wunused-label -Wunused-variable -Wunused-value -Wunknown-pragmas -=
Wsign-compare -Werror=3Duninitialized -Werror=3Dpointer-arith -Werror=3Dint=
-conversion -Werror=3Dincompatible-pointer-types -Werror=3Ddiscarded-qualif=
iers -Werror=3Ddeclaration-after-statement -Werror-implicit-function-declar=
ation   -c localaddr.c=0A=
localaddr.c: In function 'krb5int_foreach_localaddr':=0A=
localaddr.c:978:35: warning: left-hand operand of comma expression has no e=
ffect [-Wunused-value]=0A=
         Tprintf (("interface %s\n", ifreq.ifr_name));=0A=
                                   ^=0A=
localaddr.c:83:28: note: in definition of macro 'Tprintf'=0A=
 # define Tprintf(X) (void) X=0A=
                            ^=0A=
localaddr.c:945:12: warning: unused variable 'size' [-Wunused-variable]=0A=
     size_t size, n, i, j;=0A=
            ^~~~=0A=
localaddr.c:943:12: warning: unused variable 'code' [-Wunused-variable]=0A=
     int s, code;=0A=
            ^~~~=0A=
=0A=
Regards,=0A=
=0A=
Cordialement,=0A=
=0A=
Tony Reix=0A=
=0A=
Bull - ATOS=0A=
IBM Coop Architect & Technical Leader=0A=
Office : +33 (0) 4 76 29 72 67=0A=
1 rue de Provence - 38432 =C9chirolles - France=0A=
www.atos.net=0A=
=0A=
________________________________________=0A=
De : Greg Hudson [ghudson@mit.edu]=0A=
Envoy=E9 : mercredi 23 ao=FBt 2017 17:14=0A=
=C0 : REIX, Tony; krbdev@mit.edu=0A=
Objet : Re: On AIX with GCC 6.3.0, a "maybe-unitialized" variable generates=
 an error.=0A=
=0A=
On 08/23/2017 09:28 AM, REIX, Tony wrote:=0A=
> On AIX with GCC 6.3.0, a "maybe-unitialized" variable generates an error.=
=0A=
=0A=
> localaddr.c:1033:9: error: 'n' may be used uninitialized in this function=
 [-Werror=3Dmaybe-uninitialized]=0A=
>         for (i =3D 0; i + sizeof(struct ifreq) <=3D n; i+=3D ifreq_size(*=
ifr) ) {=0A=
=0A=
It looks like n is supposed to be set by get_ifreq_array(), but this=0A=
particular version of gcc isn't smart enough to determine that=0A=
get_ifreq_array() always either sets *np or returns nonzero, perhaps=0A=
because of the case at line 892 where errno is used as a return value.=0A=
My preferred fix for this sort of problem is to make get_ifreq_array()=0A=
begin with:=0A=
=0A=
    *bufp =3D NULL;=0A=
    *np =3D 0;=0A=
=0A=
Does that make the error go away?=0A=
=0A=
Thanks.=0A=
=0A=
(As a side note, if you are comfortable using github, you could file=0A=
these patches as pull requests against https://github.com/krb5/krb5 .=0A=
Otherwise I will take care of filing PRs.)=0A=

--_002_B37989F2852398498001550C29155BE5178BBB28FRCRPVV9EX3MSXw_
Content-Type: text/x-patch;
	name="krb5-1.15.1-maybe-uninitialized-for-krb5-community.patch"
Content-Description: krb5-1.15.1-maybe-uninitialized-for-krb5-community.patch
Content-Disposition: attachment;
	filename="krb5-1.15.1-maybe-uninitialized-for-krb5-community.patch";
	size=380; creation-date="Wed, 23 Aug 2017 15:27:57 GMT";
	modification-date="Wed, 23 Aug 2017 15:27:57 GMT"
Content-Transfer-Encoding: base64

LS0tIC4vc3JjL2xpYi9rcmI1L29zL2xvY2FsYWRkci5jLk9SSUdJTgkyMDE3LTA4LTIzIDE1OjEz
OjE5ICswMjAwCisrKyAuL3NyYy9saWIva3JiNS9vcy9sb2NhbGFkZHIuYwkyMDE3LTA4LTIzIDE3
OjI0OjIyICswMjAwCkBAIC04NjEsNiArODYxLDkgQEAKICAgICBpbnQgbnVtaWZzID0gLTE7CiAj
ZW5kaWYKIAorICAgICpidWZwID0gTlVMTDsKKyAgICAqbnAgPSAwOworCiAgICAgLyogQXQgbGVh
c3Qgb24gTmV0QlNELCBhbiBpZnJlcSBjYW4gaG9sZCBhbiBJUHY0IGFkZHJlc3MsIGJ1dAogICAg
ICAgIGlzbid0IGJpZyBlbm91Z2ggZm9yIGFuIElQdjYgb3IgZXRoZXJuZXQgYWRkcmVzcy4gIFNv
IGFkZCBhCiAgICAgICAgbGl0dGxlIG1vcmUgc3BhY2UuICAqLwo=

--_002_B37989F2852398498001550C29155BE5178BBB28FRCRPVV9EX3MSXw_
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

--_002_B37989F2852398498001550C29155BE5178BBB28FRCRPVV9EX3MSXw_--

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