From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOpyB-0005UR-6F for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:26:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOpy4-0000Zt-VL for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:26:07 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:32901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOpy4-0000Zd-Qh for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:26:00 -0400 Received: by mail-wg0-f48.google.com with SMTP id n12so7027227wgh.19 for ; Tue, 02 Sep 2014 08:26:00 -0700 (PDT) From: David Marchand Date: Tue, 2 Sep 2014 17:25:30 +0200 Message-Id: <1409671532-12706-13-git-send-email-david.marchand@6wind.com> In-Reply-To: <1409671532-12706-1-git-send-email-david.marchand@6wind.com> References: <1409671532-12706-1-git-send-email-david.marchand@6wind.com> Subject: [Qemu-devel] [PATCH v4 12/14] contrib/ivshmem-*: various fixes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, stefanha@gmail.com, claudio.fontana@huawei.com, armbru@redhat.com, arei.gonglei@huawei.com, pbonzini@redhat.com, jani.kokkonen@huawei.com, cam@cs.ualberta.ca More fixes following Gonglei comments: - add a missing \n in a debug message. - add an explicit initialisation of sock_fd. - fix a check on vector index. Signed-off-by: David Marchand --- contrib/ivshmem-client/ivshmem-client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/ivshmem-client/ivshmem-client.c b/contrib/ivshmem-client/ivshmem-client.c index e9a19ff..ad210c8 100644 --- a/contrib/ivshmem-client/ivshmem-client.c +++ b/contrib/ivshmem-client/ivshmem-client.c @@ -105,7 +105,7 @@ handle_server_msg(IvshmemClient *client) if (fd == -1) { if (peer == NULL || peer == &client->local) { - debug_log(client, "receive delete for invalid peer %ld", peer_id); + debug_log(client, "receive delete for invalid peer %ld\n", peer_id); return -1; } @@ -155,6 +155,7 @@ ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path, client->notif_cb = notif_cb; client->notif_arg = notif_arg; client->verbose = verbose; + client->sock_fd = -1; return 0; } @@ -309,7 +310,7 @@ ivshmem_client_notify(const IvshmemClient *client, uint64_t kick; int fd; - if (vector > peer->vectors_count) { + if (vector >= peer->vectors_count) { debug_log(client, "invalid vector %u on peer %ld\n", vector, peer->id); return -1; } -- 1.7.10.4