From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39957 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKvPm-0000tq-7y for qemu-devel@nongnu.org; Tue, 23 Nov 2010 11:08:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKvPg-0002zk-Vv for qemu-devel@nongnu.org; Tue, 23 Nov 2010 11:08:17 -0500 Received: from cantor.suse.de ([195.135.220.2]:58080 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKvPg-0002zS-QC for qemu-devel@nongnu.org; Tue, 23 Nov 2010 11:08:12 -0500 Message-ID: <4CEBE790.9070305@suse.de> Date: Tue, 23 Nov 2010 17:10:56 +0100 From: Hannes Reinecke MIME-Version: 1.0 References: <20101122101536.649BAF8D70@ochil.suse.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] scsi: Implement 'get_sense' callback List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, nab@linux-iscsi.org, kraxel@redhat.com On 11/22/2010 10:56 PM, Stefan Hajnoczi wrote: > On Mon, Nov 22, 2010 at 10:15 AM, Hannes Reinecke wrote: >> +static int scsi_get_sense(SCSIRequest *req, uint8_t *outbuf, int len) >> +{ >> + SCSIGenericState *s =3D DO_UPCAST(SCSIGenericState, qdev, req->de= v); >> + int size =3D SCSI_SENSE_BUF_SIZE; >=20 > If there is no error we return SCSI_SENSE_BUF_SIZE without touching > outbuf? I was expecting a memset(outbuf, 0, ...) or something that > initializes outbuf. >=20 If there is no error SG_ERR_DRIVER_SENSE is not set, hence there is no sense data to fill out. But yes, you are correct; we should be doing something sensible here. I'll be setting it to 'NO SENSE' for initialisation. >> + >> + if (s->driver_status & SG_ERR_DRIVER_SENSE) { >> + if (len < SCSI_SENSE_BUF_SIZE) >=20 > {} >=20 >> + size =3D len; >> + else >=20 > {} >=20 OK, will be fixing it with the next patchset. Cheers, Hannes --=20 Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg GF: Markus Rex, HRB 16746 (AG N=FCrnberg)