Re: do_div considered harmful

From: Steve French (smfrench@austin.rr.com)
Date: Mon Aug 04 2003 - 00:31:17 EST


I have made a change to fix this in fs/cifs/inode.c and a similar
problem in fs/cifs/file.c
(and a change to fs/cifs/cifsfs.c to better match the blocksize bits and
blocksize default).
It is (version 0.8.7 of the cifs vfs) in
bk://cifs.bkbits.net/linux-2.5cifs and I am testing it now.

>> Similarly, I find in fs/cifs/inode.c>
>> inode->i_blocks = do_div(findData.NumOfBytes,
inode->i_blksize);
>
>This should be
>
> int blocksize = 1 << inode->i_blkbits;
>
> inode->i_blocks = (findData.NumOfBytes + blocksize - 1)
> >> inode->i_blkbits;

-
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/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:22 EST