From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 06 of 10 v2] libxl: expand the libxl_bitmap API a bit Date: Thu, 21 Jun 2012 11:46:01 +0200 Message-ID: <1340271961.4856.3.camel@Solace> References: <8ef7de2b4328e4f65982.1339779874@Solace> <1340271008.21872.37.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4100000043151327924==" Return-path: In-Reply-To: <1340271008.21872.37.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Andre Przywara , Stefano Stabellini , George Dunlap , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org --===============4100000043151327924== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-OBsyJWiwhK4LNXc2PdmY" --=-OBsyJWiwhK4LNXc2PdmY Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2012-06-21 at 10:30 +0100, Ian Campbell wrote: > > diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c > > --- a/tools/libxl/libxl_utils.c > > +++ b/tools/libxl/libxl_utils.c > > @@ -506,6 +506,35 @@ void libxl_bitmap_dispose(libxl_bitmap * > > free(map->map); > > } > > =20 > > +void libxl_bitmap_copy(libxl_ctx *ctx, libxl_bitmap *dptr, > > + const libxl_bitmap *sptr) > > +{ > > + int sz; > > + > > + sz =3D dptr->size =3D sptr->size; > > + memcpy(dptr->map, sptr->map, sz * sizeof(*dptr->map)); >=20 > I think you need either some checks/asserts on the two relative sizes or > a reallocation of the destination map. Otherwise you risk an overflow. >=20 > Perhaps a simple assert (i.e. make it the callers problem) would be ok? >=20 Sounds reasonable, will do that. Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-OBsyJWiwhK4LNXc2PdmY 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 v1.4.12 (GNU/Linux) iEYEABECAAYFAk/i7VkACgkQk4XaBE3IOsQiRQCfRKIzxuzky8VtgJxrmU3wXKWh mHIAnA1bgwtVPmdUyq+iIR8hsE0HDWIg =rDap -----END PGP SIGNATURE----- --=-OBsyJWiwhK4LNXc2PdmY-- --===============4100000043151327924== 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 --===============4100000043151327924==--