From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7Iw4-0002CB-I1 for qemu-devel@nongnu.org; Sun, 26 Jan 2014 01:11:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7Ivy-0006Un-9i for qemu-devel@nongnu.org; Sun, 26 Jan 2014 01:11:12 -0500 Received: from paradis.irqsave.net ([62.212.105.220]:48357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7Ivx-0006UZ-VM for qemu-devel@nongnu.org; Sun, 26 Jan 2014 01:11:06 -0500 Date: Sun, 26 Jan 2014 07:11:02 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140126061101.GD2958@irqsave.net> References: <1390546944-9687-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1390546944-9687-1-git-send-email-famz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] scsi: Change scsi sense buf size to 252 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Paolo Bonzini , qemu-devel@nongnu.org Le Friday 24 Jan 2014 =E0 15:02:24 (+0800), Fam Zheng a =E9crit : > Current buffer size fails the assersion check in like >=20 > hw/scsi/scsi-bus.c:1655: assert(req->sense_len <=3D sizeof(req->= sense)); >=20 > when backend (block/iscsi.c) returns more data then 96. >=20 > Exercise the core dump path by booting an Gentoo ISO with scsi-generic > device backed with iscsi (built with libiscsi 1.7.0): >=20 > x86_64-softmmu/qemu-system-x86_64 \ > -drive file=3Discsi://localhost:3260/iqn.foobar/0,if=3Dnone,id=3Ddr= ive-disk \ > -device virtio-scsi-pci,id=3Dscsi1,bus=3Dpci.0,addr=3D0x6 \ > -device scsi-generic,drive=3Ddrive-disk,bus=3Dscsi1.0,id=3Discsi-di= sk \ > -boot d \ > -cdrom gentoo.iso >=20 > qemu-system-x86_64: hw/scsi/scsi-bus.c:1655: scsi_req_complete: > Assertion `req->sense_len <=3D sizeof(req->sense)' failed. >=20 > According to SPC-4, section 4.5.2.1, 252 is the limit of sense data. So > increase the value to fix it. >=20 > Also remove duplicated define for the macro. >=20 > Signed-off-by: Fam Zheng > --- > hw/scsi/scsi-generic.c | 2 -- > hw/scsi/spapr_vscsi.c | 1 - > include/hw/scsi/scsi.h | 2 +- > 3 files changed, 1 insertion(+), 4 deletions(-) >=20 > diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c > index 8f195be..4967e47 100644 > --- a/hw/scsi/scsi-generic.c > +++ b/hw/scsi/scsi-generic.c > @@ -37,8 +37,6 @@ do { fprintf(stderr, "scsi-generic: " fmt , ## __VA_A= RGS__); } while (0) > #include > #include "block/scsi.h" > =20 > -#define SCSI_SENSE_BUF_SIZE 96 > - > #define SG_ERR_DRIVER_TIMEOUT 0x06 > #define SG_ERR_DRIVER_SENSE 0x08 > =20 > diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c > index c0c46d7..e8bca39 100644 > --- a/hw/scsi/spapr_vscsi.c > +++ b/hw/scsi/spapr_vscsi.c > @@ -60,7 +60,6 @@ > #define VSCSI_MAX_SECTORS 4096 > #define VSCSI_REQ_LIMIT 24 > =20 > -#define SCSI_SENSE_BUF_SIZE 96 > #define SRP_RSP_SENSE_DATA_LEN 18 > =20 > typedef union vscsi_crq { > diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h > index bf6da3d..ca66454 100644 > --- a/include/hw/scsi/scsi.h > +++ b/include/hw/scsi/scsi.h > @@ -31,7 +31,7 @@ typedef struct SCSISense { > uint8_t ascq; > } SCSISense; > =20 > -#define SCSI_SENSE_BUF_SIZE 96 > +#define SCSI_SENSE_BUF_SIZE 252 > =20 > struct SCSICommand { > uint8_t buf[SCSI_CMD_BUF_SIZE]; > --=20 > 1.8.5.3 >=20 >=20 Reviewed-by: Benoit Canet