[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] qemu-io: better input validation for vector
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] qemu-io: better input validation for vector-based commands |
Date: |
Thu, 02 Jul 2009 11:20:09 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Christoph Hellwig schrieb:
> Fix up a couple of issues with validating the input of the various
> length arguments for the vectored I/O commands:
>
> - do the alignment check on each length instead the always 0 count
> argument
> - use a long long varibale for the cvtnum return value so that we
> can check wether it wasn't a number
> - check for a too large argument instead of truncating it
>
> Also refactor it into a common helper for all four calers and avoid
> parsing the numbers twice.
>
>
> Signed-off-by: Christoph Hellwig <address@hidden>
>
> Index: qemu/qemu-io.c
> ===================================================================
> --- qemu.orig/qemu-io.c 2009-07-01 11:15:39.429264493 +0200
> +++ qemu/qemu-io.c 2009-07-01 11:24:14.463366645 +0200
> @@ -98,6 +98,56 @@ print_report(const char *op, struct time
> }
> }
>
> +/*
> + * Parse multiple length statements for vectored I/O.
> + */
> +static void *
> +parse_multiple_len(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern)
Hey, a function with a comment! :-)
Now what about using this comment to describe what the function is
actually doing? I mean it doesn't only parse the lengths but prepares a
buffer and an IO vector. It even returns the buffer (before looking at
the code I wondered what void* a pure parsing function might return...)
Otherwise the patch looks good to me.
Kevin