[MTD] Avoid 64-bit division in mtdconcat
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat May 20 05:59:02 EDT 2006
Commit: 6c8b44abc86a3e23dd1a22c0ee187f06bd7c7f5d
Parent: 5fc3dbc418e01345e25e96b3192a1c46051c3fdc
Author: Andrew Morton <akpm at osdl.org>
AuthorDate: Sat May 20 10:17:21 2006 +0100
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat May 20 10:17:21 2006 +0100
[MTD] Avoid 64-bit division in mtdconcat
WARNING: "__moddi3" [drivers/mtd/mtdconcat.ko] undefined!
Signed-off-by: Andrew Morton <akpm at osdl.org>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
drivers/mtd/mtdconcat.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index b7de908..3c61a98 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -19,6 +19,8 @@ #include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/concat.h>
+#include <asm/div64.h>
+
/*
* Our storage structure:
* Subdev points to an array of pointers to struct mtd_info objects
@@ -276,9 +278,11 @@ concat_writev_ecc(struct mtd_info *mtd,
return -EINVAL;
/* Check alignment */
- if (mtd->oobblock > 1)
- if ((to % mtd->oobblock) || (total_len % mtd->oobblock))
+ if (mtd->oobblock > 1) {
+ loff_t __to = to;
+ if (do_div(__to, mtd->oobblock) || (total_len % mtd->oobblock))
return -EINVAL;
+ }
/* make a copy of vecs */
vecs_copy = kmalloc(sizeof(struct kvec) * count, GFP_KERNEL);
More information about the linux-mtd-cvs
mailing list