From nobody Sun May 19 15:05:12 2024 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=1611156934; cv=none; d=zohomail.com; s=zohoarc; b=b0EA9zzuNcqkVIcJpGn1bTt1Vryy/hlgJNFS4kbHo5qcbN/WLqnwCCB1QAqC9pFI5DAdVU+I8r3ynBIkFIIm3Yx/5g04qmoyUc0+whPQKJZG9iQkepzzBjemNSQqCxXDxi9JljVquDUQom4cDwlqZiBN/t9D783LQbuam9G492o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611156934; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=dRuJ+Yxjk+hGk6Df5FDgfFqIR+ImclUGnmgOl1AbDwU=; b=Wd6uJjzQkz7tFxhAZ5cpTdOx1PCa8F1yWimuslqwWCvEwObXRZkHnTzx3E9fKeGqtGo8h8Vl3ca0wdxTIX+RcdxWXVoVpMe9QGGOsJt7SgCWR+hGMtYY/9n3exx9CA/6hL6v5AmdRS3u9aMcNnUBJtZmK6ATY6E5vzrrLyK2dBY= 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 1611156934537786.9536420360305; Wed, 20 Jan 2021 07:35:34 -0800 (PST) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-lX1yjlgbMn6R7zXB375j_Q-1; Wed, 20 Jan 2021 10:35:31 -0500 Received: by mail-ed1-f72.google.com with SMTP id f21so10985491edx.23 for ; Wed, 20 Jan 2021 07:35:31 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id g25sm1254975edw.92.2021.01.20.07.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 07:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611156933; 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=dRuJ+Yxjk+hGk6Df5FDgfFqIR+ImclUGnmgOl1AbDwU=; b=Zul6Bxn8ZlcqAl2QQ2BCdltv1OymOlDeWu4XQTyKNcURwiF7g6eUYSKyWjtr5Y9e3+IRmc f3f8aNNY7lUDGv2HhXMIF46wnQa1I4IqbQ5exItFJ7VIHqfcf3KNEx8il2SgQzM9KuhCVi 6Y9d4Y4eiMQ9ATMb1SnJIV+su8G8Kyg= X-MC-Unique: lX1yjlgbMn6R7zXB375j_Q-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=dRuJ+Yxjk+hGk6Df5FDgfFqIR+ImclUGnmgOl1AbDwU=; b=pxnEBkKzpN1k8pjuYYsnNiemrCy1Effs5dLJDwOrrypi9SKK1sw5/sYVaSHb/y8s9J C5KbUqBSfUWDTSCd9JuOE52ndFmiCWrpxCYUZLyTvgsoEwWWLQmHHnCxdaT4YmChXxYE YrHM0/jrnU289c47KSfl9mMzDbe+ReQB0Ae1kAETtqje/FmQxiaEUsX6okivG4jsMfKI IWYsh2LBFOtj+oVfJqW9jXt7Q0C8Y8HsVBXBR0HUXhTCKR79iso4I/Zmyg3keZeHeeaP xJxfBUtv2zmscveLGa1UIXV8Km/GPnww9DIOlq1G9uHtHGnJ90mfM1NbyQxQwYKB184L 6E6w== X-Gm-Message-State: AOAM530VM80CZX+/oYW2Fy1EZFXROIHOEO0P/UZeOpTm1mv+UmhuY5dC +nkk4ADLXgVEkdNISxO5uYTmLJOJDaoRauhgtVXj+FoVzaYsrNT2FccUXEfm/mxjQsPGdh0bLIm D87IfLNZ8aEddlw== X-Received: by 2002:a50:bf4a:: with SMTP id g10mr7515826edk.201.1611156930628; Wed, 20 Jan 2021 07:35:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEgla3aopU7yGXjeZs79Hl+QjCx8YyP67pPdLnAeI0O64hSvaDc8FX/YGP1MVCh+XWfuX8eA== X-Received: by 2002:a50:bf4a:: with SMTP id g10mr7515810edk.201.1611156930494; Wed, 20 Jan 2021 07:35:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fam Zheng , Gerd Hoffmann , qemu-block@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake Subject: [PATCH v2 1/3] scsi/utils: Rename 'illegal request' -> 'invalid request' Date: Wed, 20 Jan 2021 16:35:20 +0100 Message-Id: <20210120153522.1173897-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210120153522.1173897-1-philmd@redhat.com> References: <20210120153522.1173897-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) While these requests are invalid, they are not breaking any laws :) Rename 'illegal request' as 'invalid request'. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- include/scsi/utils.h | 20 ++++++++++---------- scsi/utils.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/scsi/utils.h b/include/scsi/utils.h index fbc55882799..725769be3cb 100644 --- a/include/scsi/utils.h +++ b/include/scsi/utils.h @@ -49,25 +49,25 @@ extern const struct SCSISense sense_code_NO_MEDIUM; extern const struct SCSISense sense_code_NOT_READY_REMOVAL_PREVENTED; /* Hardware error, internal target failure */ extern const struct SCSISense sense_code_TARGET_FAILURE; -/* Illegal request, invalid command operation code */ +/* Invalid request, invalid command operation code */ extern const struct SCSISense sense_code_INVALID_OPCODE; -/* Illegal request, LBA out of range */ +/* Invalid request, LBA out of range */ extern const struct SCSISense sense_code_LBA_OUT_OF_RANGE; -/* Illegal request, Invalid field in CDB */ +/* Invalid request, Invalid field in CDB */ extern const struct SCSISense sense_code_INVALID_FIELD; -/* Illegal request, Invalid field in parameter list */ +/* Invalid request, Invalid field in parameter list */ extern const struct SCSISense sense_code_INVALID_PARAM; -/* Illegal request, Parameter list length error */ +/* Invalid request, Parameter list length error */ extern const struct SCSISense sense_code_INVALID_PARAM_LEN; -/* Illegal request, LUN not supported */ +/* Invalid request, LUN not supported */ extern const struct SCSISense sense_code_LUN_NOT_SUPPORTED; -/* Illegal request, Saving parameters not supported */ +/* Invalid request, Saving parameters not supported */ extern const struct SCSISense sense_code_SAVING_PARAMS_NOT_SUPPORTED; -/* Illegal request, Incompatible format */ +/* Invalid request, Incompatible format */ extern const struct SCSISense sense_code_INCOMPATIBLE_FORMAT; -/* Illegal request, medium removal prevented */ +/* Invalid request, medium removal prevented */ extern const struct SCSISense sense_code_ILLEGAL_REQ_REMOVAL_PREVENTED; -/* Illegal request, Invalid Transfer Tag */ +/* Invalid request, Invalid Transfer Tag */ extern const struct SCSISense sense_code_INVALID_TAG; /* Command aborted, I/O process terminated */ extern const struct SCSISense sense_code_IO_ERROR; diff --git a/scsi/utils.c b/scsi/utils.c index b37c2830148..41ad49459ca 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -177,52 +177,52 @@ const struct SCSISense sense_code_TARGET_FAILURE =3D { .key =3D HARDWARE_ERROR, .asc =3D 0x44, .ascq =3D 0x00 }; =20 -/* Illegal request, invalid command operation code */ +/* Invalid request, invalid command operation code */ const struct SCSISense sense_code_INVALID_OPCODE =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x20, .ascq =3D 0x00 }; =20 -/* Illegal request, LBA out of range */ +/* Invalid request, LBA out of range */ const struct SCSISense sense_code_LBA_OUT_OF_RANGE =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x21, .ascq =3D 0x00 }; =20 -/* Illegal request, Invalid field in CDB */ +/* Invalid request, Invalid field in CDB */ const struct SCSISense sense_code_INVALID_FIELD =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x24, .ascq =3D 0x00 }; =20 -/* Illegal request, Invalid field in parameter list */ +/* Invalid request, Invalid field in parameter list */ const struct SCSISense sense_code_INVALID_PARAM =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x26, .ascq =3D 0x00 }; =20 -/* Illegal request, Parameter list length error */ +/* Invalid request, Parameter list length error */ const struct SCSISense sense_code_INVALID_PARAM_LEN =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x1a, .ascq =3D 0x00 }; =20 -/* Illegal request, LUN not supported */ +/* Invalid request, LUN not supported */ const struct SCSISense sense_code_LUN_NOT_SUPPORTED =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x25, .ascq =3D 0x00 }; =20 -/* Illegal request, Saving parameters not supported */ +/* Invalid request, Saving parameters not supported */ const struct SCSISense sense_code_SAVING_PARAMS_NOT_SUPPORTED =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x39, .ascq =3D 0x00 }; =20 -/* Illegal request, Incompatible medium installed */ +/* Invalid request, Incompatible medium installed */ const struct SCSISense sense_code_INCOMPATIBLE_FORMAT =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x30, .ascq =3D 0x00 }; =20 -/* Illegal request, medium removal prevented */ +/* Invalid request, medium removal prevented */ const struct SCSISense sense_code_ILLEGAL_REQ_REMOVAL_PREVENTED =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x53, .ascq =3D 0x02 }; =20 -/* Illegal request, Invalid Transfer Tag */ +/* Invalid request, Invalid Transfer Tag */ const struct SCSISense sense_code_INVALID_TAG =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x4b, .ascq =3D 0x01 }; --=20 2.26.2 From nobody Sun May 19 15:05:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1611156941; cv=none; d=zohomail.com; s=zohoarc; b=XLNM+e+4AJJF5/RHqwBb7uxdOKB1L2Mt0UkUggZFH76BSoF08ARTNvWZcC5kU065eEg5jpyW450UH4caWldK2iAP5OrtQot0NbZ3Tfo2JH2oAFZ4OFp/NafRVCj8e8GPLLAWRUeHlkEYJ8R+4BKCoTvAlLbJGglfUc2owj9Ahbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611156941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=jx/Wb4LvZ7AbGBuxHjbFJNJf6s2H1GP3ixoLVOfoyFI=; b=kQUs1N0QtQGM5BXgdYK0YDJ3LmVI1hhXFLHBTqiEXRH+xvDyyuXrMddoe0Lnwmt8ABnfbtF/SoCofk2tlqNCkYpwcvwRDFu+O5z1zbPgJ2Pg+LE6yFVjoxTobHuHmCTe0TJ3DT8feDpZUkjrUyeMTEnBnsTwrLFlyFodKEWd/bI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611156941427803.3641208078509; Wed, 20 Jan 2021 07:35:41 -0800 (PST) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-OzS1iLbDNxePxHlYy5C0RQ-1; Wed, 20 Jan 2021 10:35:38 -0500 Received: by mail-ed1-f70.google.com with SMTP id n18so11210632eds.2 for ; Wed, 20 Jan 2021 07:35:38 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id q2sm1289210edn.91.2021.01.20.07.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 07:35:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611156940; 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=jx/Wb4LvZ7AbGBuxHjbFJNJf6s2H1GP3ixoLVOfoyFI=; b=WXNx2QY7+RIeTs/Np1XOPn5M7R0XnfidAkH/dOFYW07ST7kpRj09TMvVNhPvy6eendzWAv NsVeJMAalw3howuO7hrQaZhI4RoRXxMlWIHLgR9tVuCUqHSqwQuk63yNlL5yFZxPrHKOCn A2NuMGVonWaSSUqOJBZmkw/2nLuVwoI= X-MC-Unique: OzS1iLbDNxePxHlYy5C0RQ-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=jx/Wb4LvZ7AbGBuxHjbFJNJf6s2H1GP3ixoLVOfoyFI=; b=LrKD/5h8M7r8ffJ29H5ntKFFtqAPj5D6ZSYDTY5DkBKBEm9GUmxD19WsQG6r2SwvSG aqPWmsp7RDWeBVTRQwXJfOOjpd3wfKPRyc3no/agbYzJXTUFZHtxo31hKjiF2RrdB6ws u+wCMK1/gFCMDqUWFaNv++A01LfEBGb8mLzjY4BEdgVKlu5p9GUptjCOM4o75R3JIUQX 2EPBeHEUJA80IcESmGScPyy+S0iE7j3TtMN4JFEAju4wiHu/3QeD+li6D2ERlzqTX4Y2 XzRIRawiKlVBa4WRQUH+JBXcF2b4tMH90RHPKkuStkl3o0mACnzuCUSP4P5lESYEWS9q LQDA== X-Gm-Message-State: AOAM532rchYHp7A2knXGweYd322AEUgyOhC5xGL3kgWwdYJLLoR7e+k0 nR9r21hEJ/DUV1C/c1siAbJ/5pp4pR9FwynCr8kEHr5rNAneqSodly2Bt3yZQPzYPf6o76tLXdt pXTOomu3KCN+Pqw== X-Received: by 2002:a17:907:175c:: with SMTP id lf28mr6573005ejc.110.1611156935970; Wed, 20 Jan 2021 07:35:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCLTSz6/quqU61KEYzXTVpYZnQtczGulvN5JKtqs8lQHq6jImImZzi+AgkIKnuwPOnr6uQVQ== X-Received: by 2002:a17:907:175c:: with SMTP id lf28mr6572991ejc.110.1611156935858; Wed, 20 Jan 2021 07:35:35 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fam Zheng , Gerd Hoffmann , qemu-block@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake Subject: [PATCH v2 2/3] scsi/utils: Add INVALID_PARAM_VALUE sense code definition Date: Wed, 20 Jan 2021 16:35:21 +0100 Message-Id: <20210120153522.1173897-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210120153522.1173897-1-philmd@redhat.com> References: <20210120153522.1173897-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) Reviewed-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/scsi/utils.h | 2 ++ scsi/utils.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/scsi/utils.h b/include/scsi/utils.h index 725769be3cb..504cde1cc9b 100644 --- a/include/scsi/utils.h +++ b/include/scsi/utils.h @@ -57,6 +57,8 @@ extern const struct SCSISense sense_code_LBA_OUT_OF_RANGE; extern const struct SCSISense sense_code_INVALID_FIELD; /* Invalid request, Invalid field in parameter list */ extern const struct SCSISense sense_code_INVALID_PARAM; +/* Invalid request, Invalid value in parameter list */ +extern const struct SCSISense sense_code_INVALID_PARAM_VALUE; /* Invalid request, Parameter list length error */ extern const struct SCSISense sense_code_INVALID_PARAM_LEN; /* Invalid request, LUN not supported */ diff --git a/scsi/utils.c b/scsi/utils.c index 41ad49459ca..e9082da7420 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -197,6 +197,11 @@ const struct SCSISense sense_code_INVALID_PARAM =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x26, .ascq =3D 0x00 }; =20 +/* Invalid request, Invalid value in parameter list */ +const struct SCSISense sense_code_INVALID_PARAM_VALUE =3D { + .key =3D ILLEGAL_REQUEST, .asc =3D 0x26, .ascq =3D 0x01 +}; + /* Invalid request, Parameter list length error */ const struct SCSISense sense_code_INVALID_PARAM_LEN =3D { .key =3D ILLEGAL_REQUEST, .asc =3D 0x1a, .ascq =3D 0x00 --=20 2.26.2 From nobody Sun May 19 15:05:12 2024 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=1611156949; cv=none; d=zohomail.com; s=zohoarc; b=KfMjAfWcPwZvgebkpwyJ6bmrzBTHf9e4enTcoK9enGwhm0SCou+Trt6VFP7CDL/UvuMViMI1VHQ5VIWZ2yJ8pTmuUxb4c6Grn37qMAqzO9+SHF+BAcs9XfJXFbzEY7ThrTypdPR16kChs7ml3XghJm+1jFZuuvxWYmDHgf3vgNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611156949; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=vy08SPUQILRszwUrUSWnviExWQtbBP9Rn4kirCQh3nA=; b=ZzAEtQVAff12BA3KA8e3irk5KlliEtjW2EU2rz3z8dGYz1iYquM93DzY6X+GGDkZCcV+IBkBRpoefP+DPee898D7H93zx4SOia2SDbZD+Ysy4bphlG50Lzc0DehINNTdYhkwh6heCq0ECxs/sxzS4SpB1s0O9ValmMWE4szFvYg= 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 1611156949199355.14076675497563; Wed, 20 Jan 2021 07:35:49 -0800 (PST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-U5R6W5voPiS4s9fJTjar2w-1; Wed, 20 Jan 2021 10:35:43 -0500 Received: by mail-ed1-f71.google.com with SMTP id l33so11217138ede.1 for ; Wed, 20 Jan 2021 07:35:42 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id fi12sm1047413ejb.49.2021.01.20.07.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 07:35:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611156948; 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=vy08SPUQILRszwUrUSWnviExWQtbBP9Rn4kirCQh3nA=; b=WPY63YnpOQvaCeK/VbZmdcvq3BTV2rE36JtayB37OYJktmmWIvbOoWDf4CCyOjTqZS8/Eh d485kJmLr+0oH1sCEvZ9UBe2vopK1IJlOeIRtK5njffx/T8tzEECumi7rV7b6IemMF5uO1 +SSQHNKcgISSlIZRHZ1Optq1FpBW+d4= X-MC-Unique: U5R6W5voPiS4s9fJTjar2w-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=vy08SPUQILRszwUrUSWnviExWQtbBP9Rn4kirCQh3nA=; b=bRsv++wIgyLfHbvFMaLgnZVAoiZFAIGpbhD3lv4j1ZRHKiZRaS9AmCoat7OUliwO5P ku+JoBJHofGU36E68x63sbtzMmqUM2jXEpECSg0kWp2g/dEyNjHL2hfFdf1Y9jNeY3cZ ftJM3a/aUjCICj90DWACFt/wiCMTXdwz5T7YsETvJTHFVwY9RAHMXfsH6SHbXpQZoym0 xhkJdkhy97DZ3dwnO8or7ugGF3jXnRNVOivX8iaukM4G6zTzSEoyCnl5j+kk/2kmauOH fp5/BP+7SB6cww/LAv+mzCMXFgqzeNU+dH7W8X/nZiavseksN+kccgS5n1jLxg5eozik 1BLQ== X-Gm-Message-State: AOAM530VR2Lio+EPEuQi+uJwQ96LDD+7r+jW/bsCwc48uuDfdqTOb8PE uVhF0zpHubAzPAjyySXFK/QeBGiK4En/KTSs70wW8wsgtfvwdxgIydM55spkwOMsVQvqXzy6fWS GBZ/F2kRk0JjJVw== X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr7449728edu.360.1611156941668; Wed, 20 Jan 2021 07:35:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8enPAcy7hcRg7vWLAhqswghY4GH4q3U2qKOzBkcNB+KYFU91/zupqwyEmoJs/pn+sTan90Q== X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr7449702edu.360.1611156941492; Wed, 20 Jan 2021 07:35:41 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fam Zheng , Gerd Hoffmann , qemu-block@nongnu.org, Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ed Maste , Daniele Buono , Han Han , Eric Blake , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Gustavo A . R . Silva" Subject: [PATCH v2 3/3] hw/usb/dev-uas: Report command additional adb length as unsupported Date: Wed, 20 Jan 2021 16:35:22 +0100 Message-Id: <20210120153522.1173897-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210120153522.1173897-1-philmd@redhat.com> References: <20210120153522.1173897-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) We are not ready to handle additional CDB data. If a guest sends a packet with such additional data, report the command parameter as not supported. Specify a size (of 1 byte) for the add_cdb member we are not using, to fix the following warning: usb/dev-uas.c:157:31: error: field 'status' with variable sized type 'uas= _iu' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-= variable-sized-type-not-at-end] uas_iu status; ^ Reported-by: Ed Maste Reported-by: Daniele Buono Reported-by: Han Han Reviewed-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Cc: Marc-Andr=C3=A9 Lureau Cc: Paolo Bonzini Cc: Gustavo A. R. Silva v2: include Eric feedbacks --- hw/usb/dev-uas.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index cec071d96c4..a51402bc0bf 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -16,6 +16,7 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/log.h" =20 #include "hw/usb.h" #include "migration/vmstate.h" @@ -70,7 +71,7 @@ typedef struct { uint8_t reserved_2; uint64_t lun; uint8_t cdb[16]; - uint8_t add_cdb[]; + uint8_t add_cdb[1]; /* not supported by QEMU */ } QEMU_PACKED uas_iu_command; =20 typedef struct { @@ -700,6 +701,11 @@ static void usb_uas_command(UASDevice *uas, uas_iu *iu) uint32_t len; uint16_t tag =3D be16_to_cpu(iu->hdr.tag); =20 + if (iu->command.add_cdb_length > 0) { + qemu_log_mask(LOG_UNIMP, "additional adb length not yet supported\= n"); + goto unsupported_len; + } + if (uas_using_streams(uas) && tag > UAS_MAX_STREAMS) { goto invalid_tag; } @@ -735,6 +741,10 @@ static void usb_uas_command(UASDevice *uas, uas_iu *iu) } return; =20 +unsupported_len: + usb_uas_queue_fake_sense(uas, tag, sense_code_INVALID_PARAM_VALUE); + return; + invalid_tag: usb_uas_queue_fake_sense(uas, tag, sense_code_INVALID_TAG); return; --=20 2.26.2