mtd: sm_ftl: fix wrong do_div() usage

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:06 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2b2462d5928379b8f43ffe19d72d069bfb89d316
Commit:     2b2462d5928379b8f43ffe19d72d069bfb89d316
Parent:     d55d31a6b8f65bb13e1912043a66295cc928967c
Author:     Nicolas Pitre <nicolas.pitre at linaro.org>
AuthorDate: Wed Nov 4 15:21:21 2015 -0500
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Nov 16 15:07:16 2015 -0800

    mtd: sm_ftl: fix wrong do_div() usage
    
    do_div() is meant to be used with an unsigned dividend.
    
    Signed-off-by: Nicolas Pitre <nico at linaro.org>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/sm_ftl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index c23184a..b096f8b 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -206,9 +206,10 @@ static loff_t sm_mkoffset(struct sm_ftl *ftl, int zone, int block, int boffset)
 }
 
 /* Breaks offset into parts */
-static void sm_break_offset(struct sm_ftl *ftl, loff_t offset,
+static void sm_break_offset(struct sm_ftl *ftl, loff_t loffset,
 			    int *zone, int *block, int *boffset)
 {
+	u64 offset = loffset;
 	*boffset = do_div(offset, ftl->block_size);
 	*block = do_div(offset, ftl->max_lba);
 	*zone = offset >= ftl->zone_count ? -1 : offset;



More information about the linux-mtd-cvs mailing list