From nobody Sat May 11 19:18:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1680161759; cv=none; d=zohomail.com; s=zohoarc; b=i2GYzal5JKtQ1zOTMnuNvZfBdkqOe4J0rIqHh+FHB3Uh3KUY7EcE5tsRqgMhh6Go7JBs2OPTerLM/RLXZ1LxTS2YGSdZn4717JolCVxqp/uYd55pgJbF0I0kxsJejNf2byyGfPyC/DaLyeLSGjXjdviv+hXBHATP0gi3EsgASC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680161759; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=WSnfA1xgOrFdrD1/DW7OzeR7rpuxX2XteyLNIaEJqAY=; b=aatHMARt6Gpot2o6i7wHNBnlyeEOa7XOaJwHj4C7jdsagjCn2POv9RJEnBhnswjhot8EOKE4GDEOEVW8oRKILJxcODRTYQnVL6WWVoe1ebL35MPlD7xBAyazKg2//TpatwQLFOjj5B/X/hifpx2cR45ONpxwOwAzf7dOe3uHvHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1680161759807659.8000134178436; Thu, 30 Mar 2023 00:35:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.516436.800502 (Exim 4.92) (envelope-from ) id 1phmoU-0003uZ-J4; Thu, 30 Mar 2023 07:35:14 +0000 Received: by outflank-mailman (output) from mailman id 516436.800502; Thu, 30 Mar 2023 07:35:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phmoU-0003uS-GS; Thu, 30 Mar 2023 07:35:14 +0000 Received: by outflank-mailman (input) for mailman id 516436; Thu, 30 Mar 2023 07:35:12 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phmoS-0003sp-J7 for xen-devel@lists.xen.org; Thu, 30 Mar 2023 07:35:12 +0000 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [2607:f8b0:4864:20::102c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 648bc214-cecd-11ed-b464-930f4c7d94ae; Thu, 30 Mar 2023 09:35:10 +0200 (CEST) Received: by mail-pj1-x102c.google.com with SMTP id lr16-20020a17090b4b9000b0023f187954acso18728875pjb.2 for ; Thu, 30 Mar 2023 00:35:08 -0700 (PDT) Received: from localhost ([122.172.85.168]) by smtp.gmail.com with ESMTPSA id q27-20020a63505b000000b0050bebfe464dsm22584611pgl.53.2023.03.30.00.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 00:35:05 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 648bc214-cecd-11ed-b464-930f4c7d94ae DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680161706; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WSnfA1xgOrFdrD1/DW7OzeR7rpuxX2XteyLNIaEJqAY=; b=mKHZeRK2T67SBQRQnLlCNRWdHicKqCwoQhpM3ylzBn9jEOn8YzHce33QTb3P0pLxTw pHojPgD4QgActMYmWuZRqijtUrCo1FkY49EKdd3ibiGtJOQuSfphxxVh8zgok06rhU0N vC5j0FNcCg+RlbV4gUTGr8WjpPks+kedZ0KLoFEmf3Tvr/bhM0xmbNz8w7khbOObZEsr cQRVIqYSlrhqpr4fgweeETBn5syQnP5zBfvgIQUtoL1Sq4LH9e9xBu6fLzhsNIDJ6MYn DBsUtenVWwVrOe11m+9f52K31OdVhtt4qXdP26oYpjsmSjKas9NlN7aR5yEBN4YmRAu/ +U/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680161706; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WSnfA1xgOrFdrD1/DW7OzeR7rpuxX2XteyLNIaEJqAY=; b=T9NCRpSFlxY3M0Gm7/Fddg286LwAYicA7F0NUSP9xnOyFLWQJiijux205fTuvzRJdY wP/1UsiCjf2lzkkcpJGls50XD1mTYy3d+lVBBkzOuF3h7NPj31zMGr1d8kcKGMPNxb0x BZMhXx9wqrw7U2COFH9gTn4L/4AW9FtpRn4chlsOHvlkNdtqOZEJbo0Lj/bD1AaIcQwb InF6bFFGnvXFUxe55PFrCegrPDu0zhmrwf7ntKKpTYFb2zyn3mg0F3RHlf1zcRtsdpF2 KfKnyWkMHPs/1rAzOIzpyUrSU7v80veTH8UcJTdPzh+S+Xb6PWQFFxoEToc2Cuanh5Y9 vheA== X-Gm-Message-State: AAQBX9fQq/g+9UltuLvhaXmLSaT8CIyNw0lwhmfOzrYLoi+8MPk1ZbMa rHlzIKWcdD4aOAvcpoNRujnba/VV0cl+TkV/zbU= X-Google-Smtp-Source: AKy350akyf7uqfZf0nMu+zqKFWa+fISDa2zCy8RuuYyd57sXyKt8Te3SQUefftZ0budYajOZBItyAg== X-Received: by 2002:a17:903:5c8:b0:1a1:ad52:4060 with SMTP id kf8-20020a17090305c800b001a1ad524060mr19378730plb.20.1680161706074; Thu, 30 Mar 2023 00:35:06 -0700 (PDT) From: Viresh Kumar To: xen-devel@lists.xen.org, Juergen Gross , Julien Grall , Anthony PERARD Cc: Viresh Kumar , Vincent Guittot , stratos-dev@op-lists.linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mathieu Poirier , Oleksandr Tyshchenko , Erik Schilling Subject: [PATCH] libxl: fix matching of generic virtio device Date: Thu, 30 Mar 2023 13:05:02 +0530 Message-Id: <210b5be4b7e84fce1519663f28ca24f6761fb2cb.1680161663.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1680161762320100001 Content-Type: text/plain; charset="utf-8" The strings won't be an exact match, and 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. Signed-off-by: Viresh Kumar --- 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 =3D 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 =3D 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; + } } =20 return fdt_end_node(fdt); --=20 2.31.1.272.g89b43f80a514