Re: fix compile-time divide-by-zero in scsi_ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 27, 2006 at 04:28:26PM -0700, David Brownell wrote:
> On Wednesday 27 September 2006 1:27 pm, Matthew Wilcox wrote:
> > On Tue, Sep 26, 2006 at 08:48:48AM -0700, David Brownell wrote:
> > > This fixes a compiler-reported divide-by-zero when HZ < 100.
> > 
> > Shouldn't we instead be using jiffies_to_clock_t?  Thus:
> 
> Could be ... the units in that function unclear to me though.

Me too, tbh.  But the function looks right.

static inline clock_t jiffies_to_clock_t(long x)
{
#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
        return x / (HZ / USER_HZ);
#else
        u64 tmp = (u64)x * TICK_NSEC;
        do_div(tmp, (NSEC_PER_SEC / USER_HZ));
        return (long)tmp;
#endif
}

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux