From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [blktap2] fix two 'maybe uninitialized' variables Date: Wed, 11 Jun 2014 14:09:34 +0200 Message-ID: <1402488574.16827.92.camel@Solace> References: <1402488062.16827.90.camel@Solace> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6277374198151873932==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WuhLg-0002xx-VG for xen-devel@lists.xenproject.org; Wed, 11 Jun 2014 12:09:49 +0000 In-Reply-To: <1402488062.16827.90.camel@Solace> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Campbell , Ian Jackson , Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============6277374198151873932== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-W/43jq1Nr4lIN3rVL/Af" --=-W/43jq1Nr4lIN3rVL/Af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mmm... a better subject line for this would have been: [PATCH] blktap2: fix two 'maybe uninitialized' variables Sorry! :-/ Let me know it you want me to resent like that. Regards, Dario On mer, 2014-06-11 at 14:01 +0200, Dario Faggioli wrote: > for which gcc 4.9.0 complains about, like this: >=20 > block-qcow.c: In function =E2=80=98get_cluster_offset=E2=80=99: > block-qcow.c:431:3: error: =E2=80=98tmp_ptr=E2=80=99 may be used uninitia= lized in this function [-Werror=3Dmaybe-uninitialized] > memcpy(tmp_ptr, l1_ptr, 4096); > ^ > block-qcow.c:606:7: error: =E2=80=98tmp_ptr2=E2=80=99 may be used uniniti= alized in this function [-Werror=3Dmaybe-uninitialized] > if (write(s->fd, tmp_ptr2, 4096) !=3D 4096) { > ^ > cc1: all warnings being treated as errors > /home/dario/Sources/xen/xen/xen.git/tools/blktap2/drivers/../../../tools/= Rules.mk:89: recipe for target 'block-qcow.o' failed > make[5]: *** [block-qcow.o] Error 1 >=20 > Signed-off-by: Dario Faggioli > --- > diff --git a/tools/blktap2/drivers/block-qcow.c b/tools/blktap2/drivers/b= lock-qcow.c > index d5053d4..c677bc9 100644 > --- a/tools/blktap2/drivers/block-qcow.c > +++ b/tools/blktap2/drivers/block-qcow.c > @@ -383,8 +383,8 @@ static uint64_t get_cluster_offset(struct tdqcow_stat= e *s, > int n_start, int n_end) > { > int min_index, i, j, l1_index, l2_index, l2_sector, l1_sector; > - char *tmp_ptr2, *l2_ptr, *l1_ptr; > - uint64_t *tmp_ptr; > + char *tmp_ptr2 =3D NULL, *l2_ptr, *l1_ptr; > + uint64_t *tmp_ptr =3D NULL; > uint64_t l2_offset, *l2_table, cluster_offset, tmp; > uint32_t min_count; > int new_l2_table; >=20 --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-W/43jq1Nr4lIN3rVL/Af Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEABECAAYFAlOYRv4ACgkQk4XaBE3IOsSa8QCeLfL3SdUUPNN3PcLwJpDTd0Uo mVYAn0XiLlZ0dr1cKsVmTWO+fZV6vqMT =lNG8 -----END PGP SIGNATURE----- --=-W/43jq1Nr4lIN3rVL/Af-- --===============6277374198151873932== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============6277374198151873932==--