Fix remaining bug of the off-by-one error ;)
[openwrt.git] / target / linux / ar7 / patches-2.6.25 / 200-mtd_fixes.patch
1 --- a/drivers/mtd/ar7part.c
2 +++ b/drivers/mtd/ar7part.c
3 @@ -34,6 +34,10 @@
4 #define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42)
5 #define LOADER_MAGIC2 le32_to_cpu(0xfeed1281)
6
7 +#ifndef SQUASHFS_MAGIC
8 +#define SQUASHFS_MAGIC 0x73717368
9 +#endif
10 +
11 struct ar7_bin_rec {
12 unsigned int checksum;
13 unsigned int length;
14 @@ -47,7 +51,8 @@
15 unsigned long origin)
16 {
17 struct ar7_bin_rec header;
18 - unsigned int offset, len;
19 + unsigned int offset;
20 + size_t len;
21 unsigned int pre_size = master->erasesize, post_size = 0;
22 unsigned int root_offset = ROOT_OFFSET;
23
24 @@ -66,7 +71,7 @@
25 do { /* Try 10 blocks starting from master->erasesize */
26 offset = pre_size;
27 master->read(master, offset,
28 - sizeof(header), &len, (u8 *)&header);
29 + sizeof(header), &len, (uint8_t *)&header);
30 if (!strncmp((char *)&header, "TIENV0.8", 8))
31 ar7_parts[1].offset = pre_size;
32 if (header.checksum == LOADER_MAGIC1)
33 @@ -88,7 +93,7 @@
34 while (header.length) {
35 offset += sizeof(header) + header.length;
36 master->read(master, offset, sizeof(header),
37 - &len, (u8 *)&header);
38 + &len, (uint8_t *)&header);
39 }
40 root_offset = offset + sizeof(header) + 4;
41 break;
42 @@ -96,10 +101,10 @@
43 while (header.length) {
44 offset += sizeof(header) + header.length;
45 master->read(master, offset, sizeof(header),
46 - &len, (u8 *)&header);
47 + &len, (uint8_t *)&header);
48 }
49 root_offset = offset + sizeof(header) + 4 + 0xff;
50 - root_offset &= ~(u32)0xff;
51 + root_offset &= ~(uint32_t)0xff;
52 break;
53 default:
54 printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum);
This page took 0.045424 seconds and 5 git commands to generate.