[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] blkback: Sanity-check nr_segments parameter.
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1194546368 0 # Node ID cf8b6cafa2f0a8ba698322786cc78ae28a1b0f60 # Parent f539cd7c933160670e2709f3954269883f9f5284 blkback: Sanity-check nr_segments parameter. From: Gerd Hoffmann <kraxel@xxxxxxxxxx> Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxxxxx> --- include/xen/blkif.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff -r f539cd7c9331 -r cf8b6cafa2f0 include/xen/blkif.h --- a/include/xen/blkif.h Wed Nov 07 15:19:39 2007 -0700 +++ b/include/xen/blkif.h Thu Nov 08 18:26:08 2007 +0000 @@ -72,25 +72,29 @@ enum blkif_protocol { static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src) { - int i; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; dst->operation = src->operation; dst->nr_segments = src->nr_segments; dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - for (i = 0; i < src->nr_segments; i++) + if (n > src->nr_segments) + n = src->nr_segments; + for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } static void inline blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src) { - int i; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; dst->operation = src->operation; dst->nr_segments = src->nr_segments; dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - for (i = 0; i < src->nr_segments; i++) + if (n > src->nr_segments) + n = src->nr_segments; + for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |