diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-07-25 15:05:13 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2022-07-29 09:48:01 +0100 |
commit | aed04e6357fa10735c43574ea67a9551580d6e82 (patch) | |
tree | 7710fa9331194802b2d8234d91d1b044b749e34e /storage-daemon | |
parent | 93a02e822fc65d8f16eb98f64af88d69ba3c9fd6 (diff) | |
download | qemu-aed04e6357fa10735c43574ea67a9551580d6e82.zip qemu-aed04e6357fa10735c43574ea67a9551580d6e82.tar.gz qemu-aed04e6357fa10735c43574ea67a9551580d6e82.tar.bz2 |
semihosting: Don't return negative values on qemu_semihosting_console_write() failure
The documentation comment for qemu_semihosting_console_write() says
* Returns: number of bytes written -- this should only ever be short
* on some sort of i/o error.
and the callsites rely on this. However, the implementation code
path which sends console output to a chardev doesn't honour this,
and will return negative values on error. Bring it into line with
the other implementation codepaths and the documentation, so that
it returns 0 on error.
Spotted by Coverity, because console_write() passes the return value
to unlock_user(), which doesn't accept a negative length.
Resolves: Coverity CID 1490288
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220719121110.225657-2-peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220725140520.515340-7-alex.bennee@linaro.org>
Diffstat (limited to 'storage-daemon')
0 files changed, 0 insertions, 0 deletions