Skip to content

Commit

Permalink
[MTD] Avoid 64-bit division in mtdconcat
Browse files Browse the repository at this point in the history
WARNING: "__moddi3" [drivers/mtd/mtdconcat.ko] undefined!

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Andrew Morton authored and David Woodhouse committed May 20, 2006
1 parent 5fc3dbc commit 6c8b44a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/mtd/mtdconcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#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
Expand Down Expand Up @@ -276,9 +278,11 @@ concat_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
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);
Expand Down

0 comments on commit 6c8b44a

Please sign in to comment.