Re: [RFC][PATCH] Use proper casting with signed timespec.tv_nsec values

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

 



On Tue, 2005-09-06 at 10:33 -0700, Christoph Lameter wrote:
> On Thu, 1 Sep 2005, john stultz wrote:
> 
> > 	I recently ran into a bug with an older kernel where xtime's tv_nsec
> > field had accumulated more then 2 seconds worth of time. The timespec's
> > tv_nsec is a signed long, however gettimeofday() treats it as an
> > unsigned long. Thus when the failure occured, very strange and difficult
> > to debug time problems occurred.
> 
> How can that happen? I think the source of the problem needs to be fixed. 
> The fix is only going decrease the likelyhood of the problem occurring.

Really it shouldn't, I'm just adding the extra casting to be more
explicit to if at some point in the future a bug does creep up, it will
be easier to understand. The code is assuming we're unsigned, so why not
make that clear to the compiler?

Granted, its not really all that critical and it is a bit paranoid. I
just figured I'd float the patch to see if folks thought it would be a
good idea. 

thanks
-john



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux