aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-12-05 15:28:24 -0500
committerJens Axboe <jens.axboe@oracle.com>2007-12-18 02:29:28 -0500
commit24bb8fb99a062213424d3e88842eb07f693378be (patch)
treec9bce1eba2ab11ea06b89776f157fd4793169adc
parentc63a1190368771b8207d86c4217ae4afdf1cbd5e (diff)
block: use jiffies conversion functions in scsi_ioctl.c
Use msecs_to_jiffies() and jiffies_to_msecs() in scsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/scsi_ioctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 91c73224f4c6..9675b34638d4 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
230 rq->cmd_len = hdr->cmd_len; 230 rq->cmd_len = hdr->cmd_len;
231 rq->cmd_type = REQ_TYPE_BLOCK_PC; 231 rq->cmd_type = REQ_TYPE_BLOCK_PC;
232 232
233 rq->timeout = (hdr->timeout * HZ) / 1000; 233 rq->timeout = msecs_to_jiffies(hdr->timeout);
234 if (!rq->timeout) 234 if (!rq->timeout)
235 rq->timeout = q->sg_timeout; 235 rq->timeout = q->sg_timeout;
236 if (!rq->timeout) 236 if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
366 */ 366 */
367 blk_execute_rq(q, bd_disk, rq, 0); 367 blk_execute_rq(q, bd_disk, rq, 0);
368 368
369 hdr->duration = ((jiffies - start_time) * 1000) / HZ; 369 hdr->duration = jiffies_to_msecs(jiffies - start_time);
370 370
371 return blk_complete_sghdr_rq(rq, hdr, bio); 371 return blk_complete_sghdr_rq(rq, hdr, bio);
372out: 372out: