From nobody Tue Feb 10 04:03:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603964122; cv=none; d=zohomail.com; s=zohoarc; b=PwkIHOHDCAuWJUoosyIRW6sSjz5KR1J8XGrYhu88Do7Zkq0pLIe0LycKXfA6fLtFi55PkvhGVZsuP0E5NwlkSN7csFWI9saIKdZSSIIBBPt72BpIOj5KLZwcACjfLZcKEdX/OUovu/6OTzbeBzR+xo2vzBQg1bMLWGlWH9tqagc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603964122; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=jQdVLyA0HVgiMvXs6yUcdivebDmIqTIYpGDHtX3oQERGC43gQ2t5JXXrR4rD8JqpHctOHCn+xuTbk4Ik+P6O9269sAi0j/Dz6LJMMgl4rBO0zU3A2EAKhngEKremwzG89GyUdTn4msnkao8WkIEXjglYgMg8XteKylc9gABjdbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603964122546980.7880337320003; Thu, 29 Oct 2020 02:35:22 -0700 (PDT) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-U3-ibXnONcC6GIjxz_YA9w-1; Thu, 29 Oct 2020 05:35:19 -0400 Received: by mail-ej1-f72.google.com with SMTP id z8so949782ejw.3 for ; Thu, 29 Oct 2020 02:35:19 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id ao17sm1179118ejc.18.2020.10.29.02.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 02:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603964121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=TPsWIhM6wYF/Tx4fggUt3W5J4it8vdN2i4LkqQV51cdPqpUJUcDUQPsOHAboc4bPg4smDE WD4dPcQoM2JGu+XrApSYsmTsoyz6quA6sushrdrZ6d98xE8cbOOnSHaH0vFvL3YB+a/JBQ mzCRXRsMsSMTZotSgceYBqULYLpW38I= X-MC-Unique: U3-ibXnONcC6GIjxz_YA9w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E7ARdMdjChejWzNOv4rbThOcf14/Pp3Q0pevnTZmOLU=; b=XXTgzjJlR1g5riYLaupCQjZAnVmQsrDY6X0zUMzIStXwi7BOubvqZ39QN9CQS1Tz2v Ry0fOfUnopwA1qlZDYZTvZv0+1aHgzY7BP0RlUFRHotD0i6PXabIVsXZkKI9dVvpBljB aqZwvmzGJ3oenIjbnLh1g4ojITrEHF3HSsc0W4w1B4uItIeeLMfQIw+Vsl+jodzttvoK ZfrpEv9/02MGUxzP3lTWtxic7zSrgKrvxuzExBbhe6uy9yqbCRajXawg3/QPPe+U7jyd wGoasJPzE+IIoD0Lv6CMMM8804gQ/me4T4AqmKzJ2ken6+XtDP9tO+kUfu1OTiLtIyvl Z70g== X-Gm-Message-State: AOAM530dPuyvdy7Wur2sbgYqne8VQIwrw2EfHuw81xHHGlw76OGp+agJ LJInomf7aRWTSOQZ52v/eSARW8UfdmiParK/EVCcpYMQML8qqcKJs1+vEoeXELjTxVTRpHE/Rdu syFxwRhIX6D8Ykw== X-Received: by 2002:aa7:d843:: with SMTP id f3mr3132444eds.354.1603964117843; Thu, 29 Oct 2020 02:35:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAay3pmJYlLgbH6MPTB2Q0PEhx1HhlZ8YZ0CFL2D+WbqyLxHWDudhWsgUz+4hKpE6k5jM12w== X-Received: by 2002:aa7:d843:: with SMTP id f3mr3132424eds.354.1603964117514; Thu, 29 Oct 2020 02:35:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , Klaus Jensen , Eric Auger , Max Reitz , Fam Zheng , Keith Busch , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-5.2 v2 24/25] block/nvme: Fix nvme_submit_command() on big-endian host Date: Thu, 29 Oct 2020 10:33:05 +0100 Message-Id: <20201029093306.1063879-25-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029093306.1063879-1-philmd@redhat.com> References: <20201029093306.1063879-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The Completion Queue Command Identifier is a 16-bit value, so nvme_submit_command() is unlikely to work on big-endian hosts, as the relevant bits are truncated. Fix by using the correct byte-swap function. Fixes: bdd6a90a9e5 ("block: Add VFIO based NVMe driver") Reported-by: Keith Busch Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index c8ef69cbb28..a06a188d530 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -469,7 +469,7 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeR= equest *req, assert(!req->cb); req->cb =3D cb; req->opaque =3D opaque; - cmd->cid =3D cpu_to_le32(req->cid); + cmd->cid =3D cpu_to_le16(req->cid); =20 trace_nvme_submit_command(q->s, q->index, req->cid); nvme_trace_command(cmd); --=20 2.26.2