From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZykUa-0002cd-Qb for qemu-devel@nongnu.org; Tue, 17 Nov 2015 12:56:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZykUa-0001fT-0J for qemu-devel@nongnu.org; Tue, 17 Nov 2015 12:56:32 -0500 Date: Tue, 17 Nov 2015 18:56:24 +0100 From: Christoph Hellwig Message-ID: <20151117175624.GA20785@lst.de> References: <1447765689-28940-1-git-send-email-hch@lst.de> <1447765689-28940-2-git-send-email-hch@lst.de> <20151117172539.GA21832@localhost.localdomain> <20151117174104.GA22112@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151117174104.GA22112@localhost.localdomain> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] nvme: fix identify to be NVMe 1.1 compliant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Keith Busch Cc: Christoph Hellwig , "qemu-block@nongnu.org" , "qemu-devel@nongnu.org" On Tue, Nov 17, 2015 at 05:41:04PM +0000, Keith Busch wrote: > On Tue, Nov 17, 2015 at 09:33:11AM -0800, Busch, Keith wrote: > > I accidently deleted my comment. Here's what it said: > >=20 > > + list =3D g_malloc(data_len); > > + for (i =3D 0; i < n->num_namespaces; i++) { > > + if (i <=3D min_nsid) { > > + continue; > > + } > > + list[i] =3D i; > >=20 > > This should be: > >=20 > > + list[i] =3D cpu_to_le32(i); >=20 > Just saw this: we can't use the raw 'i' for the list index. It could > return a badly formatted list if min_nsid is non-zero, or, even worse, > corrupt memory if num_namsepaces > 1024. Need to do this instead: >=20 > + list[i - min_nsid] =3D cpu_to_le32(i); Oh yes, =D0=86'll need to fix that up.