[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 1/2] blockdev: Error out on negative throttli
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v4 1/2] blockdev: Error out on negative throttling option values |
Date: |
Mon, 18 Jan 2016 09:09:22 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, 01/15 15:28, Kevin Wolf wrote:
> Am 15.01.2016 um 03:09 hat Fam Zheng geschrieben:
> > The implicit casting from unsigned int to double changes negative values
> > into large positive numbers and accepts them. We should instead print
> > an error.
> >
> > Check the number range so this case is caught and reported.
> >
> > Signed-off-by: Fam Zheng <address@hidden>
> > Reviewed-by: Max Reitz <address@hidden>
> > ---
> > blockdev.c | 3 ++-
> > include/qemu/throttle.h | 2 ++
> > util/throttle.c | 16 ++++++----------
> > 3 files changed, 10 insertions(+), 11 deletions(-)
> >
> > diff --git a/blockdev.c b/blockdev.c
> > index 2df0c6d..b925e5d 100644
> > --- a/blockdev.c
> > +++ b/blockdev.c
> > @@ -348,7 +348,8 @@ static bool check_throttle_config(ThrottleConfig *cfg,
> > Error **errp)
> > }
> >
> > if (!throttle_is_valid(cfg)) {
> > - error_setg(errp, "bps/iops/maxs values must be 0 or greater");
> > + error_setg(errp, "bps/iops/max values must be within [0, %" PRId64
> > + ")", (int64_t)THROTTLE_VALUE_MAX);
>
> I think that should be "]". If you agree, I'll fix it up while applying.
Yes, that's right. Thanks.
Fam
>
> > return false;
> > }
>
> Kevin
>