qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4A4C7BC9.9050800@redhat.com> (raw)
In-Reply-To: <20090701112252.GB10455@lst.de>

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 <hch@lst.de>
> 
> 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

  reply	other threads:[~2009-07-02  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01 11:22 [Qemu-devel] [PATCH 2/2] qemu-io: better input validation for vector-based commands Christoph Hellwig
2009-07-02  9:20 ` Kevin Wolf [this message]
2009-07-02 19:12   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A4C7BC9.9050800@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).