From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lug-owl.de (lug-owl.de [188.68.32.151]) by sourceware.org (Postfix) with ESMTP id 11F1F385800F for ; Tue, 5 Oct 2021 15:32:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 11F1F385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id 81E8741F18; Tue, 5 Oct 2021 17:32:16 +0200 (CEST) Date: Tue, 5 Oct 2021 17:32:16 +0200 From: Jan-Benedict Glaw To: elfutils-devel@sourceware.org Subject: [PATCH] Tests: Fix warning in show-die-info.c Message-ID: <20211005153216.fadk42msbpz4xvx5@lug-owl.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="e3wfrbgudm2fm27c" Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.8.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 15:32:18 -0000 --e3wfrbgudm2fm27c Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! I'm running automated test compiles on Binutils, GCC, Linux, NetBSD and, since a few days ago, elfutils. Building/running the tests, I noticed this little warning: =2E../configure --enable-maintainer-mode --enable-tests-rpath --enable-gpro= f --enable-gcov --enable-valgrind --prefix=3D/tmp/elfutils make make V=3D1 [make 2021-10-01 12:18:08] /usr/lib/gcc-snapshot/bin/gcc -std=3Dgnu99 -Wall= -Wshadow -Wformat=3D2 -Wold-style-definition -Wstrict-prototypes -Wtrampol= ines -Wlogical-op -Wduplicated-cond -Wnull-dereference -Wimplicit-fallthrou= gh=3D5 -Werror -Wunused -Wextra -Wstack-usage=3D262144 -D_FORTIFY_SOURCE= =3D2 -g -O2 -pg -fprofile-arcs -ftest-coverage -Wl,-rpath-link,../libelf:..= /libdw -Wno-error=3Dstack-usage=3D -pg -fprofile-arcs -o strip strip.o ../l= ibebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a ../libelf/l= ibelf.a -lz ../libdw/libdw.a -lz -lzstd -llzma -lbz2 ../libelf/libelf.a -l= z -ldl -lpthread ../lib/libeu.a =20 [make 2021-10-01 12:18:08] /usr/lib/gcc-snapshot/bin/gcc -D_GNU_SOURCE -DHA= VE_CONFIG_H -DLOCALEDIR=3D'"/tmp/elfutils/share/locale"' -DDEBUGPRED=3D0 -= DSRCDIR=3D\"/var/lib/laminar/run/elfutils/11/elfutils/src\" -DOBJDIR=3D\"/v= ar/lib/laminar/run/elfutils/11/elfutils/src\" -I. -I.. -I. -I. -I../lib -I= =2E. -I./../libelf -I./../libebl -I./../libdw -I./../libdwelf -I./../libdwf= l -I./../libasm -std=3Dgnu99 -Wall -Wshadow -Wformat=3D2 -Wold-style-defin= ition -Wstrict-prototypes -Wtrampolines -Wlogical-op -Wduplicated-cond -Wnu= ll-dereference -Wimplicit-fallthrough=3D5 -Werror -Wunused -Wextra -D_FO= RTIFY_SOURCE=3D2 -g -O2 -pg -fprofile-arcs -ftest-coverage -MT elflint.o -M= D -MP -MF .deps/elflint.Tpo -c -o elflint.o elflint.c [make 2021-10-01 12:18:15] elflint.c: In function 'check_sections': [make 2021-10-01 12:18:15] elflint.c:4105:48: error: null pointer dereferen= ce [-Werror=3Dnull-dereference] [make 2021-10-01 12:18:15] 4105 | idx < d= atabits->d_size && ! bad; [make 2021-10-01 12:18:15] | ~= ~~~~~~~^~~~~~~~ [make 2021-10-01 12:18:18] cc1: all warnings being treated as errors [make 2021-10-01 12:18:18] make[2]: *** [Makefile:799: elflint.o] Error 1 [make 2021-10-01 12:18:18] make[1]: *** [Makefile:532: all-recursive] Error= 1 [make 2021-10-01 12:18:18] make: *** [Makefile:448: all] Error 2 As it is tested beforehand that we should not run into this, this patch should fix the warning: diff --git a/src/elflint.c b/src/elflint.c index 1ce75684..ef7725ce 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -4102,7 +4102,7 @@ section [%2zu] '%s' has type NOBITS but is read from = the file in segment of prog bad =3D (databits =3D=3D NULL || databits->d_size !=3D shdr->sh_size); for (size_t idx =3D 0; - idx < databits->d_size && ! bad; + ! bad && idx < databits->d_size; idx++) bad =3D ((char *) databits->d_buf)[idx] !=3D 0; =20 Please keep me Cc'ed as I'm not subscribed. Thanks, Jan-Benedict --=20 --e3wfrbgudm2fm27c Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCYVxv/QAKCRAdvV51g5nh u2SvAJ4+iUDGbxYw31GfZwWMjTTGZd5PFgCfaZ+YbJJodvioNijy9trI2Dn25lM= =Dx6Y -----END PGP SIGNATURE----- --e3wfrbgudm2fm27c--