1 --- a/drivers/mtd/redboot.c
2 +++ b/drivers/mtd/redboot.c
4 #include <linux/mtd/mtd.h>
5 #include <linux/mtd/partitions.h>
7 +#define BOARD_CONFIG_PART "boardconfig"
9 struct fis_image_desc {
10 unsigned char name[16]; // Null terminated name
11 uint32_t flash_base; // Address within FLASH of image
12 @@ -59,6 +61,7 @@ static int parse_redboot_partitions(stru
13 struct mtd_partition **pparts,
14 unsigned long fis_origin)
16 + unsigned long max_offset = 0;
18 struct fis_image_desc *buf;
19 struct mtd_partition *parts;
20 @@ -227,14 +230,14 @@ static int parse_redboot_partitions(stru
24 - parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
25 + parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
32 - nullname = (char *)&parts[nrparts];
33 + nullname = (char *)&parts[nrparts + 1];
34 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
36 strcpy(nullname, nullstring);
37 @@ -253,6 +256,8 @@ static int parse_redboot_partitions(stru
40 for ( ; i<nrparts; i++) {
41 + if(max_offset < buf[i].flash_base + buf[i].size)
42 + max_offset = buf[i].flash_base + buf[i].size;
43 parts[i].size = fl->img->size;
44 parts[i].offset = fl->img->flash_base;
45 parts[i].name = names;
46 @@ -286,6 +291,14 @@ static int parse_redboot_partitions(stru
50 + if(master->size - max_offset >= master->erasesize)
52 + parts[nrparts].size = master->size - max_offset;
53 + parts[nrparts].offset = max_offset;
54 + parts[nrparts].name = names;
55 + strcpy(names, BOARD_CONFIG_PART);