[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for 2.10 04/35] ivshmem: fix incorrect error han
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH for 2.10 04/35] ivshmem: fix incorrect error handling in ivshmem_recv_msg() |
Date: |
Tue, 25 Jul 2017 10:18:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Philippe Mathieu-Daudé <address@hidden> writes:
> If qemu_chr_fe_read_all() returns -EINTR the do {} statement continues and the
> n accumulator used to complete reads upto sizeof(msg) is decremented by 4 (the
> value of EINTR on Linux).
> To avoid that, use simpler if() statements and continue if EINTR occured.
>
> hw/misc/ivshmem.c:650:14: warning: Loss of sign in implicit conversion
> } while (n < sizeof(msg));
> ^
>
Let's add "Screwed up in commit 3a55fc0f, v2.6.0."
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> get_maintainer.pl: No maintainers found!
>
> hw/misc/ivshmem.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index a58f9ee579..47a015f072 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -642,7 +642,10 @@ static int64_t ivshmem_recv_msg(IVShmemState *s, int
> *pfd, Error **errp)
> do {
> ret = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + n,
> sizeof(msg) - n);
> - if (ret < 0 && ret != -EINTR) {
> + if (ret < 0) {
> + if (ret == -EINTR) {
> + continue;
> + }
> error_setg_errno(errp, -ret, "read from server failed");
> return INT64_MIN;
> }
Reviewed-by: Markus Armbruster <address@hidden>
Paolo, you taking this through your miscellaneous queue would save me
(and possibly Peter) a bit of work. Only if you have something queued
already. Let me know.
- [Qemu-devel] [PATCH for 2.10 02/35] loader: check get_image_size() return value, (continued)
- [Qemu-devel] [PATCH for 2.10 02/35] loader: check get_image_size() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 03/35] thunk: check nb_fields is valid before continuing, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 05/35] nbd: fix memory leak in nbd_opt_go(), Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 04/35] ivshmem: fix incorrect error handling in ivshmem_recv_msg(), Philippe Mathieu-Daudé, 2017/07/24
- Re: [Qemu-devel] [PATCH for 2.10 04/35] ivshmem: fix incorrect error handling in ivshmem_recv_msg(),
Markus Armbruster <=
- [Qemu-devel] [PATCH for 2.10 06/35] qcow2: remove inconsistent check, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 08/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 09/35] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/24