Re: div64.h:do_div() bug

From: Matti Aarnio (matti.aarnio_at_zmailer.org)
Date: 09/30/03

  • Next message: Sam Ravnborg: "Re: RFC: [2.6 patch] disallow modular IPv6"
    Date:	Tue, 30 Sep 2003 14:28:30 +0300
    To: Rogier Wolff <Swen-Trap1@BitWizard.nl>, Artur Klauser <Artur.Klauser@computer.org>, linux-kernel@vger.kernel.org
    
    

    On Tue, Sep 30, 2003 at 01:14:38PM +0300, Matti Aarnio wrote:
    > On Tue, Sep 30, 2003 at 11:52:29AM +0200, Rogier Wolff wrote:
    > > On Mon, Sep 29, 2003 at 03:25:19PM +0200, Artur Klauser wrote:
    > > > 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
    > >
    > > Nope.
    >
    > Nope yourself.
    >
    > > > if (in.n64 != out.n64) {
    > > > printf("FAILURE: asm/div64.h:do_div() is broken for 64-bit dividends\n");
    > >
    > > do_div should be/is documented as not doing 64 bit dividents. It does
    > > 64/32 -> 32 divides, IIRC...
    >
    > 64/32 -> 64,32
    >
    > The REMAINDER is 32 bit value.

    Non-native english speaker makes the mistake.. MODULUS is 32 bits as is
    DIVISOR, REMAINDER is 64 bit, as is DIVIDEND.

    That is:
            DIVIDEND / DIVISOR -> REMAINDER , MODULUS

    and
            REMAINDER * DIVISOR + MODULUS = DIVIDEND

    > > Roger.
     
    /Matti Aarnio
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Sam Ravnborg: "Re: RFC: [2.6 patch] disallow modular IPv6"

    Relevant Pages

    • Re: do_div considered harmful
      ... The first parameter is not uint64_t *. ... And the common case, where no remainder is used, by DO_DIV ... bugs waiting to happen. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Cant use SYSFS for "Proprietry" driver modules !!!.
      ... > The remainder of this email is available under the GNU General Public ... > THE BELOW MAY NOT BE USED IN A BINARY DRIVER, ... damn every C program is a derived work.. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: div64.h:do_div() bug
      ... > DIVISOR, REMAINDER is 64 bit, as is DIVIDEND. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: __attribute__((always_inline)) fiasco
      ... >> will cause spurious ignorance of the remainder of the line, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [2.6.1] Kernel panic with ppa driver updates
      ... Unable to handle kernel paging request at virtual address 7232b403 ... The remainder of the message was identical to the previous post -- no ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)