Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755692AbaGILMi (ORCPT ); Wed, 9 Jul 2014 07:12:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41485 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755667AbaGILMg (ORCPT ); Wed, 9 Jul 2014 07:12:36 -0400 Message-ID: <53BD23A2.4030902@suse.de> Date: Wed, 09 Jul 2014 13:12:34 +0200 From: Hannes Reinecke User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Christoph Hellwig , James Bottomley CC: Jens Axboe , Bart Van Assche , Robert Elliott , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/14] sd: don't use rq->cmd_len before setting it up References: <1403715121-1201-1-git-send-email-hch@lst.de> <1403715121-1201-2-git-send-email-hch@lst.de> In-Reply-To: <1403715121-1201-2-git-send-email-hch@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/25/2014 06:51 PM, Christoph Hellwig wrote: > Unlike the old request code blk-mq doesn't initialize cmd_len with a > default value, so don't rely on it being set in sd_setup_write_same_cmnd. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/sd.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 9c86e3d..6ec4ffe 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -824,15 +824,16 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) > > rq->__data_len = sdp->sector_size; > rq->timeout = SD_WRITE_SAME_TIMEOUT; > - memset(rq->cmd, 0, rq->cmd_len); > > if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff) { > rq->cmd_len = 16; > + memset(rq->cmd, 0, rq->cmd_len); > rq->cmd[0] = WRITE_SAME_16; > put_unaligned_be64(sector, &rq->cmd[2]); > put_unaligned_be32(nr_sectors, &rq->cmd[10]); > } else { > rq->cmd_len = 10; > + memset(rq->cmd, 0, rq->cmd_len); > rq->cmd[0] = WRITE_SAME; > put_unaligned_be32(sector, &rq->cmd[2]); > put_unaligned_be16(nr_sectors, &rq->cmd[7]); > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: J. Hawn, J. Guild, F. Imend?rffer, HRB 16746 (AG N?rnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/