From: Kevin Wolf Date: Thu, 26 Apr 2012 11:45:30 +0000 (+0200) Subject: nbd: Fix uninitialised use of s->sock X-Git-Tag: v1.1-rc0~32^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3adf53a3a10a1ca8347167907e4cf8bbd0204f1;p=thirdparty%2Fqemu.git nbd: Fix uninitialised use of s->sock s->sock is assigned only afterwards, so we're really registering an aio_fd_handler for file descriptor 0 here. Not exactly what we intended. Signed-off-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- diff --git a/block/nbd.c b/block/nbd.c index 56dbf6ef863..1212614223e 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -284,7 +284,7 @@ static int nbd_establish_connection(BlockDriverState *bs) /* Now that we're connected, set the socket to be non-blocking and * kick the reply mechanism. */ socket_set_nonblock(sock); - qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL, + qemu_aio_set_fd_handler(sock, nbd_reply_ready, NULL, nbd_have_request, s); s->sock = sock;