[libvirt] [PATCHv2] conf: fix no error when set an unsupport string in ./devices/shmem/msi[@ioeventfd]

lhuang lhuang at redhat.com
Wed May 13 03:51:35 UTC 2015


On 05/11/2015 10:08 PM, Martin Kletzander wrote:
> On Mon, May 11, 2015 at 08:59:37PM +0800, Luyao Huang wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1220265
>>
>> Pass the return value to an enum directly is not safe.
>> When pass a invalid @ioeventfd and virTristateSwitchTypeFromString
>> return -1 to def->msi.ioeventfd, and this value transform to
>> 4294967295, so no error when the parse failed.
>>
>> To fix this issue, folter the value using int and then assign it
>> to virTristateSwitch as it's done.
>>
>> Signed-off-by: Luyao Huang <lhuang at redhat.com>
>> ---
>> v2:
>>  a new way to fix this issue.
>>
>
> ACK, I reworded the commit message and pushed and I believe there is
> no need for a unit test.

Yes, thanks for your quick review.

>
> I wonder why we don't rework out FromString() helpers to parse the
> value into a parameter passed as a pointer and return 0/-1 properly.
> Probably nobody wanted to mess with half of libvirt code, I guess...
>

Maybe... :)


Luyao





More information about the libvir-list mailing list