numa: Check for qemu_strtosz_MiB error
commita73049b2a1bad81c1059b79cf4567e4d6932634f
authorEric Blake <eblake@redhat.com>
Mon, 22 May 2023 19:04:35 +0000 (22 14:04 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 2 Jun 2023 17:29:27 +0000 (2 12:29 -0500)
treee8a4a18755142c0df92b5eb1de3391ecceb42f95
parentf49371ecae182eb07cfb105aa7ea637479d83764
numa: Check for qemu_strtosz_MiB error

As shown in the previous commit, qemu_strtosz_MiB sometimes leaves the
result value untouched (we have to audit further to learn that in that
case, the QAPI generator says that visit_type_NumaOptions() will have
zero-initialized it), and sometimes leaves it with the value of a
partial parse before -EINVAL occurs because of trailing garbage.
Rather than blindly treating any string the user may throw at us as
valid, we should check for parse failures.

Fixes: cc001888 ("numa: fixup parsed NumaNodeOptions earlier", v2.11.0)
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230522190441.64278-14-eblake@redhat.com>
hw/core/numa.c