qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 00/16] introduce OptsVisitor, rebase -net/-netde


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH 00/16] introduce OptsVisitor, rebase -net/-netdev parsing
Date: Wed, 06 Jun 2012 19:05:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120422 Thunderbird/10.0.4

On 06/06/12 18:49, Laszlo Ersek wrote:

> The fallback (*v->type_int)() call stores an int64_t, according to its
> prototype ("interface contract"). IMHO it shouldn't try to communicate a
> mathematical value outside of [INT64_MIN, INT64_MAX]; it should report
> an error in this case.

Suppose the v->type_int() call fails and stores a parse error (and that
correspondingly it doesn't modify "value").

Suppose the subsequent range check fails too. In this case the current
code leaks the first Error object.

I didn't try to fix this here because my series starts with a patch from
Paolo that fixes this leak: once an error is pending, further errors are
thrown away (= not formatted / released). With that fix in place, it
doesn't matter if we enter the (value < 0) branch or not: as long as
type_int keeps error setting and value changing mutually exclusive,
we'll keep the first (= type_int) error and keep the value of *obj too.

Laszlo



reply via email to

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