* [PATCH] block: use jiffies conversion functions in scsi_ioctl.c
@ 2007-12-05 3:29 Tejun Heo
2007-12-05 20:21 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2007-12-05 3:29 UTC (permalink / raw)
To: Jens Axboe, Linux Kernel Mailing List
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>
---
block/scsi_ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 91c7322..9675b34 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,
rq->cmd_len = hdr->cmd_len;
rq->cmd_type = REQ_TYPE_BLOCK_PC;
- rq->timeout = (hdr->timeout * HZ) / 1000;
+ rq->timeout = msecs_to_jiffies(hdr->timeout);
if (!rq->timeout)
rq->timeout = q->sg_timeout;
if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
*/
blk_execute_rq(q, bd_disk, rq, 0);
- hdr->duration = ((jiffies - start_time) * 1000) / HZ;
+ hdr->duration = jiffies_to_msecs(jiffies - start_time);
return blk_complete_sghdr_rq(rq, hdr, bio);
out:
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: use jiffies conversion functions in scsi_ioctl.c
2007-12-05 3:29 [PATCH] block: use jiffies conversion functions in scsi_ioctl.c Tejun Heo
@ 2007-12-05 20:21 ` Jens Axboe
2007-12-12 3:23 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2007-12-05 20:21 UTC (permalink / raw)
To: Tejun Heo; +Cc: Linux Kernel Mailing List
On Wed, Dec 05 2007, Tejun Heo wrote:
> 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.
Thanks Tejun, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: use jiffies conversion functions in scsi_ioctl.c
2007-12-05 20:21 ` Jens Axboe
@ 2007-12-12 3:23 ` Tejun Heo
2007-12-12 7:27 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2007-12-12 3:23 UTC (permalink / raw)
To: Jens Axboe; +Cc: Linux Kernel Mailing List
Jens Axboe wrote:
> On Wed, Dec 05 2007, Tejun Heo wrote:
>> 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.
>
> Thanks Tejun, applied.
Jens, it seems premature timeout on bug 9346 could be caused by the same
problem. Can you push this so that it can go into 2.6.24?
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: use jiffies conversion functions in scsi_ioctl.c
2007-12-12 3:23 ` Tejun Heo
@ 2007-12-12 7:27 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2007-12-12 7:27 UTC (permalink / raw)
To: Tejun Heo; +Cc: Linux Kernel Mailing List
On Wed, Dec 12 2007, Tejun Heo wrote:
> Jens Axboe wrote:
> > On Wed, Dec 05 2007, Tejun Heo wrote:
> >> 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.
> >
> > Thanks Tejun, applied.
>
> Jens, it seems premature timeout on bug 9346 could be caused by the same
> problem. Can you push this so that it can go into 2.6.24?
Certainly, it'll go in for 2.6.24. I'll push it out today.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-12 7:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05 3:29 [PATCH] block: use jiffies conversion functions in scsi_ioctl.c Tejun Heo
2007-12-05 20:21 ` Jens Axboe
2007-12-12 3:23 ` Tejun Heo
2007-12-12 7:27 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).