Skip to content

Commit

Permalink
block: replace sizeof(rq->cmd) with BLK_MAX_CDB
Browse files Browse the repository at this point in the history
This is a preparation for changing rq->cmd from the static array to a
pointer.

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Boaz Harrosh <[email protected]>
Cc: Bartlomiej Zolnierkiewicz <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
fujita authored and Jens Axboe committed Apr 29, 2008
1 parent e7b241a commit d34c87e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg)

if (blk_pc_request(rq)) {
printk(KERN_INFO " cdb: ");
for (bit = 0; bit < sizeof(rq->cmd); bit++)
for (bit = 0; bit < BLK_MAX_CDB; bit++)
printk("%02x ", rq->cmd[bit]);
printk("\n");
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)

sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);

memset(rq->cmd, 0, sizeof(rq->cmd));
memset(rq->cmd, 0, BLK_MAX_CDB);
rq->cmd[0] = GPCMD_SEEK;
put_unaligned(cpu_to_be32(frame), (unsigned int *) &rq->cmd[2]);

Expand Down Expand Up @@ -1694,7 +1694,7 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
long block = (long)rq->hard_sector / (hard_sect >> 9);
unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9);

memset(rq->cmd, 0, sizeof(rq->cmd));
memset(rq->cmd, 0, BLK_MAX_CDB);

if (rq_data_dir(rq) == READ)
rq->cmd[0] = GPCMD_READ_10;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-cd_verbose.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void ide_cd_log_error(const char *name, struct request *failed_command,

printk(KERN_ERR " The failed \"%s\" packet command "
"was: \n \"", s);
for (i = 0; i < sizeof(failed_command->cmd); i++)
for (i = 0; i < BLK_MAX_CDB; i++)
printk(KERN_CONT "%02x ", failed_command->cmd[i]);
printk(KERN_CONT "\"\n");
}
Expand Down

0 comments on commit d34c87e

Please sign in to comment.