aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/rfd_ftl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/rfd_ftl.c')
-rw-r--r--drivers/mtd/rfd_ftl.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index e538c0a72abb..490b4742ce3a 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -156,7 +156,7 @@ static int scan_header(struct partition *part)
156 size_t retlen; 156 size_t retlen;
157 157
158 sectors_per_block = part->block_size / SECTOR_SIZE; 158 sectors_per_block = part->block_size / SECTOR_SIZE;
159 part->total_blocks = part->mbd.mtd->size / part->block_size; 159 part->total_blocks = (u32)part->mbd.mtd->size / part->block_size;
160 160
161 if (part->total_blocks < 2) 161 if (part->total_blocks < 2)
162 return -ENOENT; 162 return -ENOENT;
@@ -276,16 +276,17 @@ static void erase_callback(struct erase_info *erase)
276 276
277 part = (struct partition*)erase->priv; 277 part = (struct partition*)erase->priv;
278 278
279 i = erase->addr / part->block_size; 279 i = (u32)erase->addr / part->block_size;
280 if (i >= part->total_blocks || part->blocks[i].offset != erase->addr) { 280 if (i >= part->total_blocks || part->blocks[i].offset != erase->addr ||
281 printk(KERN_ERR PREFIX "erase callback for unknown offset %x " 281 erase->addr > UINT_MAX) {
282 "on '%s'\n", erase->addr, part->mbd.mtd->name); 282 printk(KERN_ERR PREFIX "erase callback for unknown offset %llx "
283 "on '%s'\n", (unsigned long long)erase->addr, part->mbd.mtd->name);
283 return; 284 return;
284 } 285 }
285 286
286 if (erase->state != MTD_ERASE_DONE) { 287 if (erase->state != MTD_ERASE_DONE) {
287 printk(KERN_WARNING PREFIX "erase failed at 0x%x on '%s', " 288 printk(KERN_WARNING PREFIX "erase failed at 0x%llx on '%s', "
288 "state %d\n", erase->addr, 289 "state %d\n", (unsigned long long)erase->addr,
289 part->mbd.mtd->name, erase->state); 290 part->mbd.mtd->name, erase->state);
290 291
291 part->blocks[i].state = BLOCK_FAILED; 292 part->blocks[i].state = BLOCK_FAILED;
@@ -345,9 +346,9 @@ static int erase_block(struct partition *part, int block)
345 rc = part->mbd.mtd->erase(part->mbd.mtd, erase); 346 rc = part->mbd.mtd->erase(part->mbd.mtd, erase);
346 347
347 if (rc) { 348 if (rc) {
348 printk(KERN_ERR PREFIX "erase of region %x,%x on '%s' " 349 printk(KERN_ERR PREFIX "erase of region %llx,%llx on '%s' "
349 "failed\n", erase->addr, erase->len, 350 "failed\n", (unsigned long long)erase->addr,
350 part->mbd.mtd->name); 351 (unsigned long long)erase->len, part->mbd.mtd->name);
351 kfree(erase); 352 kfree(erase);
352 } 353 }
353 354
@@ -763,7 +764,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
763{ 764{
764 struct partition *part; 765 struct partition *part;
765 766
766 if (mtd->type != MTD_NORFLASH) 767 if (mtd->type != MTD_NORFLASH || mtd->size > UINT_MAX)
767 return; 768 return;
768 769
769 part = kzalloc(sizeof(struct partition), GFP_KERNEL); 770 part = kzalloc(sizeof(struct partition), GFP_KERNEL);