Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Philippe Mathieu-Daudé
On 7/19/19 7:15 PM, Eric Blake wrote: > On 7/19/19 10:03 AM, Eric Blake wrote: >> We've had two separate reports of a caller running into use of >> uninitialized data if s->quit is set (one detected by gcc -O3, another >> by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' >> in t

Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Eric Blake
On 7/19/19 10:03 AM, Eric Blake wrote: > We've had two separate reports of a caller running into use of > uninitialized data if s->quit is set (one detected by gcc -O3, another > by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' > in the wrong order. Rather than chasing down whi

Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Eric Blake
On 7/19/19 10:03 AM, Eric Blake wrote: > We've had two separate reports of a caller running into use of > uninitialized data if s->quit is set (one detected by gcc -O3, another > by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' > in the wrong order. Rather than chasing down whi

Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Eric Blake
On 7/19/19 10:53 AM, Philippe Mathieu-Daudé wrote: >> if (ret < 0) { >> +memset(reply, 0, sizeof *reply); > > I never had problem with sizeof without parenthesis, but here I find it > not easy to review. Holdover from my work on GNU coding style projects: the rationale is that you c

Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Philippe Mathieu-Daudé
On 7/19/19 5:03 PM, Eric Blake wrote: > We've had two separate reports of a caller running into use of > uninitialized data if s->quit is set (one detected by gcc -O3, another > by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' > in the wrong order. Rather than chasing down whic

Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Andrey Shinkevich
On 19/07/2019 18:03, Eric Blake wrote: > We've had two separate reports of a caller running into use of > uninitialized data if s->quit is set (one detected by gcc -O3, another > by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' > in the wrong order. Rather than chasing down w

[Qemu-devel] [PATCH] nbd: Initialize reply on failure

2019-07-19 Thread Eric Blake
We've had two separate reports of a caller running into use of uninitialized data if s->quit is set (one detected by gcc -O3, another by valgrind), due to checking 'nbd_reply_is_simple(reply) || s->quit' in the wrong order. Rather than chasing down which callers need to pre-initialize reply, it's e