On 11/22/2010 10:56 PM, Stefan Hajnoczi wrote: > On Mon, Nov 22, 2010 at 10:15 AM, Hannes Reinecke <h...@suse.de> wrote: >> +static int scsi_get_sense(SCSIRequest *req, uint8_t *outbuf, int len) >> +{ >> + SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev); >> + int size = SCSI_SENSE_BUF_SIZE; > > 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. > 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) > > {} > >> + size = len; >> + else > > {} > OK, will be fixing it with the next patchset. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg)