All of lore.kernel.org
 help / color / mirror / Atom feed
* div64.h:do_div() bug
@ 2003-09-29 13:25 Artur Klauser
  2003-09-29 14:18 ` Matti Aarnio
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Artur Klauser @ 2003-09-29 13:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Artur Klauser

I've found that a bug in asm-arm/div64.h:do_div() is preventing correct
conversion of timestamps in smbfs (and probably ntfs as well) from NT to
Unix format. I'll post a patch that fixes the bug, but I think it is also
present in other architectures - at least SPARC, SH, and CRIS look
suspicious.

If people with access to these architectures could run the following small 
test and let me know the outcome, I can fix it there too - thanks.

//-----------------------------------------------------------------------------
#define __KERNEL__
#include <asm/types.h> // get kernel definition of u64, u32
#undef __KERNEL__
#include <asm/div64.h> // get definition of do_div()
#include <stdio.h>

main () {
  union {
    u64 n64;
    u32 n32[2];
  } in, out;

  in.n32[0] = 1;
  in.n32[1] = 1;
  out = in;

  do_div(out.n64, 1);

  if (in.n64 != out.n64) {
    printf("FAILURE: asm/div64.h:do_div() is broken for 64-bit dividends\n");
    exit(1);
  } else {
    printf("Congratulations: asm/div64.h:do_div() handles 64-bit dividends\n");
  }
  return 0;
}
//-----------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-09-30 13:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-29 13:25 div64.h:do_div() bug Artur Klauser
2003-09-29 14:18 ` Matti Aarnio
2003-09-30  9:52 ` Rogier Wolff
2003-09-30 10:14   ` Matti Aarnio
2003-09-30 11:28     ` Matti Aarnio
2003-09-30 12:30       ` Andreas Schwab
2003-09-30 12:41         ` Artur Klauser
2003-09-30 12:53 ` div64.h:do_div() bug - SPARC, SH anbody? Artur Klauser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.