Il 06/06/2012 13:12, Laszlo Ersek ha scritto: > The unsigned functions don't check if the int64_t value to be assigned is > negative. What happens in such a case is fully defined, but did Michael > really intend the wraparound to unsigned?
I think that's a bug. Please coordinate with Michael and Andreas (since the patch is currently lying in his tree) as to who fixes what. > I thought it was a silent requirement for the int parser to return a > non-negative int (which is something I also implemented in > opts_type_int() [*]), but the signed visit_type_XXX() functions do check > for the negative limit. I'm confused. It's not a requirement for the int parser, but I remember now: it was a requirement for the opts visitor, because qemu_opt_get_number returns uint64_t rather than int64_t. However, net_init_* shouldn't assume anything about their struct argument, so the check needs to be added there as if they weren't in the OptsVisitor. Unless you make the types stricter, of course. > If you want I can go through all the integer fields I introduced in [v1 > 06/16] "qapi schema: add Netdev types" and classify each as strictly as > possible (and then remove the checks being obviated). Yes, that would be very nice. Paolo