From: Andrew Morton Date: Sat, 20 May 2006 09:17:21 +0000 (+0100) Subject: [MTD] Avoid 64-bit division in mtdconcat X-Git-Tag: v2.6.18-rc1~1105^2~78 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c8b44abc86a3e23dd1a22c0ee187f06bd7c7f5d;p=linux-2.6 [MTD] Avoid 64-bit division in mtdconcat WARNING: "__moddi3" [drivers/mtd/mtdconcat.ko] undefined! Signed-off-by: Andrew Morton Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index b7de90845c..3c61a980c5 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -19,6 +19,8 @@ #include #include +#include + /* * 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, 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);