[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V3 2/2] libxl: fix matching of generic virtio device
- To: Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 3 May 2023 13:42:27 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T6yWBchkBNgoC9CCoa83SX//6pM98VoMRlufZMx9IEM=; b=IofnN4TDjXT29HplfUE20jkIWNUP2ZHTcDn89WiqK+UMsg+DWahRY5fBm+z6wAR7h8/dEZjIFRDuP6rkUZXNluFX19V6jZ5avoC6KirOceNJxzeSJ6DEEYqrhUdGsKurDv/rt+bf60enQ/5KLQrckMTEOaBP3ELQQ3+voGcY1iiPSSq2flZSYb1R1oTYGvwfyKCZr/JqyEJruzQdDACJaR0qSt3Z6ogZPWDMeo7M1xyb4Elj+FnASURJezFnv0B5koaxiGgh7nrMhBeEZoNDIX/LkFxuFQzSUILicT4sAV7Bv+5OiOrjO4seh2j2Me5WRciBvVw4sM1usA30RLGlpg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jzIJHT4HhHUjeJNm9Xv4nW2Mc4JnyDJHVwILzK1biKIll3zQkfRVloH9QIqqwyXKpe7WtUwgSmy3sQ16nvm7n53i01Ib53ODdFW4wBkxvFeecIuL5QBu44kXLSIRcTKyaZcAYQgz60iekk/AD2F2R88vJz7fpQRwwZe0gn5b2V3iYbB7fWVB9e2CTmp7+H/gOnL/kaStwQYsNnQ5sSfXhRrU3Sk3gTyH4biXkv+/+qU2ssjstGb/W9VpqNx8kjvy3L/b+cj38lHKwgkh0LlQEtsYhfBi+5h3vWfy65R4WdIRiNZrivGCMLNcxYZ8URw77jZtGEZgDIL4xIrEQfTAiA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>, stratos-dev@xxxxxxxxxxxxxxxxxxx, Alex Bennée <alex.bennee@xxxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, Erik Schilling <erik.schilling@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxx, Julien Grall <julien@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
- Delivery-date: Wed, 03 May 2023 11:42:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 06.04.2023 10:58, Viresh Kumar wrote:
> The strings won't be an exact match, as we are only looking to match the
> prefix here, i.e. "virtio,device". This is already done properly in
> libxl_virtio.c file, lets do the same here too.
>
> Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
While I've committed the doc patch (patch 1), I don't think I should
commit this one without a maintainer ack, even if it looks pretty
straightforward. Anthony, Wei?
Jan
> ---
> V2->V3:
> - Tag from Oleksandr.
>
> tools/libs/light/libxl_arm.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
> index ddc7b2a15975..97c80d7ed0fa 100644
> --- a/tools/libs/light/libxl_arm.c
> +++ b/tools/libs/light/libxl_arm.c
> @@ -1033,10 +1033,14 @@ static int make_virtio_mmio_node_device(libxl__gc
> *gc, void *fdt, uint64_t base,
> } else if (!strcmp(type, VIRTIO_DEVICE_TYPE_GPIO)) {
> res = make_virtio_mmio_node_gpio(gc, fdt);
> if (res) return res;
> - } else if (strcmp(type, VIRTIO_DEVICE_TYPE_GENERIC)) {
> - /* Doesn't match generic virtio device */
> - LOG(ERROR, "Invalid type for virtio device: %s", type);
> - return -EINVAL;
> + } else {
> + int len = sizeof(VIRTIO_DEVICE_TYPE_GENERIC) - 1;
> +
> + if (strncmp(type, VIRTIO_DEVICE_TYPE_GENERIC, len)) {
> + /* Doesn't match generic virtio device */
> + LOG(ERROR, "Invalid type for virtio device: %s", type);
> + return -EINVAL;
> + }
> }
>
> return fdt_end_node(fdt);
|