From 678c857f3cffb076c36ce55dfa9fb570712cec12 Mon Sep 17 00:00:00 2001
From: Martin Michlmayr <tbm@cyrius.com>
Date: Fri, 2 Feb 2007 19:14:41 +0100
Subject: [PATCH] [MTD] Don't oops when the RedBoot partition table is empty

This fixes a regression with the RedBoot parsing code introduced by
commit 0b47d654089c5ce3f2ea26a4485db9bcead1e515

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
 drivers/mtd/redboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 035cd9b0cc08..5a31f490368e 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -122,7 +122,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
 				}
 			}
 			break;
-		} else {
+		} else if (buf[i].size != -1) {
 			/* re-calculate of real numslots */
 			numslots = buf[i].size / sizeof(struct fis_image_desc);
 		}
-- 
GitLab