qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] nvme: fix identify to be NVMe 1.1 compliant


From: Keith Busch
Subject: Re: [Qemu-devel] [PATCH] nvme: fix identify to be NVMe 1.1 compliant
Date: Tue, 17 Nov 2015 17:41:04 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Nov 17, 2015 at 09:33:11AM -0800, Busch, Keith wrote:
> I accidently deleted my comment. Here's what it said:
> 
> +    list = g_malloc(data_len);
> +    for (i = 0; i < n->num_namespaces; i++) {
> +        if (i <= min_nsid) {
> +            continue;
> +        }
> +        list[i] = i;
> 
> This should be:
> 
> +        list[i] = cpu_to_le32(i);

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:

+        list[i - min_nsid] = cpu_to_le32(i);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]