From patchwork Thu Apr 26 11:45:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 155252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A136B6FEF for ; Thu, 26 Apr 2012 21:42:08 +1000 (EST) Received: from localhost ([::1]:49359 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNN5I-0005h5-KV for incoming@patchwork.ozlabs.org; Thu, 26 Apr 2012 07:42:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNN58-0005gb-Ke for qemu-devel@nongnu.org; Thu, 26 Apr 2012 07:41:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNN52-0002Zl-H3 for qemu-devel@nongnu.org; Thu, 26 Apr 2012 07:41:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNN52-0002ZP-9C for qemu-devel@nongnu.org; Thu, 26 Apr 2012 07:41:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3QBfjuX020997 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Apr 2012 07:41:46 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-6-32.ams2.redhat.com [10.36.6.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3QBfiVb005062; Thu, 26 Apr 2012 07:41:44 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Thu, 26 Apr 2012 13:45:30 +0200 Message-Id: <1335440730-27180-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH] nbd: Fix uninitialised use of s->sock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- block/nbd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index 56dbf6e..1212614 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;