5454 * tiny stub files, placeholder symlinks, and partial downloads that would
5555 * produce wildly wrong kernel-size estimates. */
5656#define MIN_VMLINUZ_BYTES (512UL * 1024)
57- #define MIN_SYSMAP_BYTES (256UL * 1024)
57+ #define MIN_SYSMAP_BYTES (256UL * 1024)
5858
5959/* stat() requires only execute permission on the parent directory, not read
6060 * permission on the file itself. */
6464 * arch/arm64/include/asm/image.h) places image_size as a u64 LE field at
6565 * byte offset 16, preceded by MZ magic at offset 0. Returns 0 on failure. */
6666static unsigned long estimate_from_image_header (const char * release ) {
67- const char * const paths [] = {
67+ const char * const paths [] = {
6868 "/boot/Image-%s" ,
6969 "/boot/vmlinuz-%s" ,
7070 NULL ,
@@ -86,14 +86,10 @@ static unsigned long estimate_from_image_header(const char *release) {
8686 continue ;
8787
8888 uint64_t image_size =
89- ((uint64_t )hdr [16 ]) |
90- ((uint64_t )hdr [17 ] << 8 ) |
91- ((uint64_t )hdr [18 ] << 16 ) |
92- ((uint64_t )hdr [19 ] << 24 ) |
93- ((uint64_t )hdr [20 ] << 32 ) |
94- ((uint64_t )hdr [21 ] << 40 ) |
95- ((uint64_t )hdr [22 ] << 48 ) |
96- ((uint64_t )hdr [23 ] << 56 );
89+ ((uint64_t )hdr [16 ]) | ((uint64_t )hdr [17 ] << 8 ) |
90+ ((uint64_t )hdr [18 ] << 16 ) | ((uint64_t )hdr [19 ] << 24 ) |
91+ ((uint64_t )hdr [20 ] << 32 ) | ((uint64_t )hdr [21 ] << 40 ) |
92+ ((uint64_t )hdr [22 ] << 48 ) | ((uint64_t )hdr [23 ] << 56 );
9793
9894 if (image_size < MIN_VMLINUZ_BYTES )
9995 continue ;
@@ -142,13 +138,12 @@ static unsigned long estimate_kernel_size(void) {
142138 return 0 ;
143139
144140 unsigned long from_hdr = estimate_from_image_header (uts .release );
145- unsigned long vmlinuz = estimate_from_vmlinuz (uts .release );
146- unsigned long sysmap = estimate_from_sysmap (uts .release );
141+ unsigned long vmlinuz = estimate_from_vmlinuz (uts .release );
142+ unsigned long sysmap = estimate_from_sysmap (uts .release );
147143
148144 /* Discard the header value if it falls below a known lower bound. */
149- if (from_hdr > 0 &&
150- ((vmlinuz > 0 && from_hdr < vmlinuz ) ||
151- (sysmap > 0 && from_hdr < sysmap )))
145+ if (from_hdr > 0 && ((vmlinuz > 0 && from_hdr < vmlinuz ) ||
146+ (sysmap > 0 && from_hdr < sysmap )))
152147 from_hdr = 0 ;
153148
154149 if (from_hdr )
0 commit comments