From patchwork Fri Oct 2 19:09:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 525735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0333F1402D5 for ; Sat, 3 Oct 2015 05:27:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=PPBPlDqv; dkim-atps=neutral Received: from localhost ([::1]:34615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5zR-0005NT-42 for incoming@patchwork.ozlabs.org; Fri, 02 Oct 2015 15:27:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5iy-0007bb-EG for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi5it-0007Dq-AP for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:32 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:38590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5it-0007Dm-3n for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:27 -0400 Received: by wiclk2 with SMTP id lk2so43240249wic.1 for ; Fri, 02 Oct 2015 12:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=hz5uD3CrJa3/8w22R3gE0lS91R8z4jY4xUTAJ0GBhV4=; b=PPBPlDqvkjFm87n/N7iI04MX6XsZvAlVRVV7Ays7kfQJBXWvNRD2OtT0gJhqVuFIyH SJy52/eTxPuWQfVKFVhv1S9ukCX4fhWf8vyJv1EL0b2oSYiVtZEwvv3qr+U5qFy53rXV Lo1zb0EW+QbJAHaYDxllLoqkVUySmYUkqzIFzF8Isuna2i1HAiRXMoXOvVpFxkrNxhpL Osd2tLDk29mGj7ZvXt89DswHE53+reeRjlRc7H1Ijd9n84O/UKc1zf4ez50j3LQfxpyx t4dMWvWO0C17GXMGX0e332K9iu9t2r9tGWLFrZdXPvDa0V5LTuZ6u0oKXGz63V6/2S70 xTZA== X-Received: by 10.194.248.165 with SMTP id yn5mr19510711wjc.97.1443813026605; Fri, 02 Oct 2015 12:10:26 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id z2sm441251wij.1.2015.10.02.12.10.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 12:10:25 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 2 Oct 2015 21:09:21 +0200 Message-Id: <1443812991-17356-19-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443812991-17356-1-git-send-email-marcandre.lureau@redhat.com> References: <1443812991-17356-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22f Cc: drjones@redhat.com, claudio.fontana@huawei.com, stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, cam@cs.ualberta.ca Subject: [Qemu-devel] [PATCH v5 18/48] ivshmem: improve error handling 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 From: Marc-André Lureau The test whether the chardev is an AF_UNIX socket rejects "-chardev socket,id=chr0,path=/tmp/foo,server,nowait -device ivshmem,chardev=chr0", but fails to explain why. Use an explicit error on why a chardev may be rejected. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 50f9c8f..d7a00bd 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -301,7 +301,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * chr = qemu_chr_open_eventfd(eventfd); if (chr == NULL) { - error_report("creating eventfd for eventfd %d failed", eventfd); + error_report("creating chardriver for eventfd %d failed", eventfd); return NULL; } qemu_chr_fe_claim_no_fail(chr); @@ -778,8 +778,12 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error **errp) attr |= PCI_BASE_ADDRESS_MEM_TYPE_64; } - if ((s->server_chr != NULL) && - (strncmp(s->server_chr->filename, "unix:", 5) == 0)) { + if (s->server_chr != NULL) { + if (strncmp(s->server_chr->filename, "unix:", 5)) { + error_setg(errp, "chardev is not a unix client socket"); + return; + } + /* if we get a UNIX socket as the parameter we will talk * to the ivshmem server to receive the memory region */