qemu-io: add cvtnum() error handling for zone commands
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 7 May 2024 18:05:58 +0000 (14:05 -0400)
committerKevin Wolf <kwolf@redhat.com>
Mon, 10 Jun 2024 09:05:43 +0000 (11:05 +0200)
commit365911b182017f05122b88a574477ff945ae91ab
treeaa4948068a6b2f3d72ea4a8ccf6f45221d8d5b0b
parente669e800fc9ef8806af5c5578249ab758a4f8a5a
qemu-io: add cvtnum() error handling for zone commands

cvtnum() parses positive int64_t values and returns a negative errno on
failure. Print errors and return early when cvtnum() fails.

While we're at it, also reject nr_zones values greater or equal to 2^32
since they cannot be represented.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Cc: Sam Li <faithilikerun@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240507180558.377233-1-stefanha@redhat.com>
Reviewed-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-io-cmds.c