浏览代码

[MTD] Avoid 64-bit division in mtdconcat

WARNING: "__moddi3" [drivers/mtd/mtdconcat.ko] undefined!

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Andrew Morton 19 年之前
父节点
当前提交
6c8b44abc8
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      drivers/mtd/mtdconcat.c

+ 6 - 2
drivers/mtd/mtdconcat.c

@@ -19,6 +19,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/concat.h>
 #include <linux/mtd/concat.h>
 
 
+#include <asm/div64.h>
+
 /*
 /*
  * Our storage structure:
  * Our storage structure:
  * Subdev points to an array of pointers to struct mtd_info objects
  * Subdev points to an array of pointers to struct mtd_info objects
@@ -276,9 +278,11 @@ concat_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
 		return -EINVAL;
 		return -EINVAL;
 
 
 	/* Check alignment */
 	/* 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;
 			return -EINVAL;
+	}
 
 
 	/* make a copy of vecs */
 	/* make a copy of vecs */
 	vecs_copy = kmalloc(sizeof(struct kvec) * count, GFP_KERNEL);
 	vecs_copy = kmalloc(sizeof(struct kvec) * count, GFP_KERNEL);