1 Index: linux-2.6.26.2/drivers/mtd/redboot.c
2 ===================================================================
3 --- linux-2.6.26.2.orig/drivers/mtd/redboot.c 2008-08-19 19:32:17.000000000 +0200
4 +++ linux-2.6.26.2/drivers/mtd/redboot.c 2008-08-19 19:47:34.000000000 +0200
6 #include <linux/mtd/mtd.h>
7 #include <linux/mtd/partitions.h>
9 +#define BOARD_CONFIG_PART "boardconfig"
11 struct fis_image_desc {
12 unsigned char name[16]; // Null terminated name
13 uint32_t flash_base; // Address within FLASH of image
15 struct mtd_partition **pparts,
16 unsigned long fis_origin)
18 + unsigned long max_offset = 0;
20 struct fis_image_desc *buf;
21 struct mtd_partition *parts;
26 - parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
27 + parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
34 - nullname = (char *)&parts[nrparts];
35 + nullname = (char *)&parts[nrparts + 1];
36 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
38 strcpy(nullname, nullstring);
42 for ( ; i<nrparts; i++) {
43 + if(max_offset < buf[i].flash_base + buf[i].size)
44 + max_offset = buf[i].flash_base + buf[i].size;
45 parts[i].size = fl->img->size;
46 parts[i].offset = fl->img->flash_base;
47 parts[i].name = names;
52 + if(master->size - max_offset >= master->erasesize)
54 + parts[nrparts].size = master->size - max_offset;
55 + parts[nrparts].offset = max_offset;
56 + parts[nrparts].name = names;
57 + strcpy(names, BOARD_CONFIG_PART);