diff options
Diffstat (limited to 'arch/x86/boot/compressed/mkpiggy.c')
-rw-r--r-- | arch/x86/boot/compressed/mkpiggy.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c index 5c228129d175..46a823882437 100644 --- a/arch/x86/boot/compressed/mkpiggy.c +++ b/arch/x86/boot/compressed/mkpiggy.c | |||
@@ -62,7 +62,12 @@ int main(int argc, char *argv[]) | |||
62 | if (fseek(f, -4L, SEEK_END)) { | 62 | if (fseek(f, -4L, SEEK_END)) { |
63 | perror(argv[1]); | 63 | perror(argv[1]); |
64 | } | 64 | } |
65 | fread(&olen, sizeof olen, 1, f); | 65 | |
66 | if (fread(&olen, sizeof(olen), 1, f) != 1) { | ||
67 | perror(argv[1]); | ||
68 | return 1; | ||
69 | } | ||
70 | |||
66 | ilen = ftell(f); | 71 | ilen = ftell(f); |
67 | olen = getle32(&olen); | 72 | olen = getle32(&olen); |
68 | fclose(f); | 73 | fclose(f); |
@@ -74,7 +79,7 @@ int main(int argc, char *argv[]) | |||
74 | 79 | ||
75 | offs = (olen > ilen) ? olen - ilen : 0; | 80 | offs = (olen > ilen) ? olen - ilen : 0; |
76 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ | 81 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ |
77 | offs += 32*1024 + 18; /* Add 32K + 18 bytes slack */ | 82 | offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ |
78 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ | 83 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ |
79 | 84 | ||
80 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); | 85 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); |