diff mbox

ide: Make ide_cdrom_prep_fs() initialize the sense buffer pointer

Message ID 20171101223149.27593-1-bart.vanassche@wdc.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche Nov. 1, 2017, 10:31 p.m. UTC
The changes introduced through commit 82ed4db499b8 assume that the
sense buffer pointer in struct scsi_request is initialized for all
requests - passthrough and filesystem requests. Hence make sure
that that pointer is initialized for filesystem requests. Remove
the memset() call that clears .cmd because the scsi_req_init()
call in ide_initialize_rq() already initializes the .cmd.

Fixes: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hongxu Jia <hongxu.jia@windriver.com>
---
 drivers/ide/ide-cd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Bart Van Assche Nov. 1, 2017, 10:33 p.m. UTC | #1
On Wed, 2017-11-01 at 15:31 -0700, Bart Van Assche wrote:
> The changes introduced through commit 82ed4db499b8 assume that the

> sense buffer pointer in struct scsi_request is initialized for all

> requests - passthrough and filesystem requests. Hence make sure

> that that pointer is initialized for filesystem requests. Remove

> the memset() call that clears .cmd because the scsi_req_init()

> call in ide_initialize_rq() already initializes the .cmd.


Hello Jens,

Please note that this patch applies on top of your for-linus branch
but is intended for kernel v4.15.

Thanks,

Bart.
Hongxu Jia Nov. 2, 2017, 2:36 a.m. UTC | #2
Apply this patch, and the test on my platform is passed.

//Hongxu

On 2017年11月02日 06:31, Bart Van Assche wrote:
> The changes introduced through commit 82ed4db499b8 assume that the
> sense buffer pointer in struct scsi_request is initialized for all
> requests - passthrough and filesystem requests. Hence make sure
> that that pointer is initialized for filesystem requests. Remove
> the memset() call that clears .cmd because the scsi_req_init()
> call in ide_initialize_rq() already initializes the .cmd.
>
> Fixes: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>   drivers/ide/ide-cd.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> index a7355ab3bb22..09b5bdb1af64 100644
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -1328,8 +1328,7 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
>   	unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9);
>   	struct scsi_request *req = scsi_req(rq);
>   
> -	scsi_req_init(req);
> -	memset(req->cmd, 0, BLK_MAX_CDB);
> +	q->initialize_rq_fn(rq);
>   
>   	if (rq_data_dir(rq) == READ)
>   		req->cmd[0] = GPCMD_READ_10;
Jens Axboe Nov. 2, 2017, 2:28 p.m. UTC | #3
On 11/01/2017 04:31 PM, Bart Van Assche wrote:
> The changes introduced through commit 82ed4db499b8 assume that the
> sense buffer pointer in struct scsi_request is initialized for all
> requests - passthrough and filesystem requests. Hence make sure
> that that pointer is initialized for filesystem requests. Remove
> the memset() call that clears .cmd because the scsi_req_init()
> call in ide_initialize_rq() already initializes the .cmd.

I'll queue this up for 4.15, post the initial merge.
Bart Van Assche Nov. 2, 2017, 2:49 p.m. UTC | #4
On Thu, 2017-11-02 at 10:36 +0800, Hongxu Jia wrote:
> Apply this patch, and the test on my platform is passed.


Thank you for having tested this patch. Does this mean that you are OK
with adding the following to this patch: Tested-by: Hongxu Jia <hongxu.jia@windriver.com> ?

Bart.
diff mbox

Patch

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index a7355ab3bb22..09b5bdb1af64 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1328,8 +1328,7 @@  static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
 	unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9);
 	struct scsi_request *req = scsi_req(rq);
 
-	scsi_req_init(req);
-	memset(req->cmd, 0, BLK_MAX_CDB);
+	q->initialize_rq_fn(rq);
 
 	if (rq_data_dir(rq) == READ)
 		req->cmd[0] = GPCMD_READ_10;