diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/boot/boot.h | 4 | ||||
-rw-r--r-- | arch/x86/boot/video-bios.c | 2 | ||||
-rw-r--r-- | arch/x86/boot/video-vesa.c | 2 | ||||
-rw-r--r-- | arch/x86/boot/video.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index 887874f4b49f..d2b5adf46512 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h | |||
@@ -216,9 +216,9 @@ static inline char *__get_heap(size_t s, size_t a, size_t n) | |||
216 | #define GET_HEAP(type, n) \ | 216 | #define GET_HEAP(type, n) \ |
217 | ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) | 217 | ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) |
218 | 218 | ||
219 | static inline int heap_free(void) | 219 | static inline bool heap_free(size_t n) |
220 | { | 220 | { |
221 | return heap_end-HEAP; | 221 | return (int)(heap_end-HEAP) >= (int)n; |
222 | } | 222 | } |
223 | 223 | ||
224 | /* copy.S */ | 224 | /* copy.S */ |
diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c index 68e65d95cdfd..ed0672a81870 100644 --- a/arch/x86/boot/video-bios.c +++ b/arch/x86/boot/video-bios.c | |||
@@ -79,7 +79,7 @@ static int bios_probe(void) | |||
79 | video_bios.modes = GET_HEAP(struct mode_info, 0); | 79 | video_bios.modes = GET_HEAP(struct mode_info, 0); |
80 | 80 | ||
81 | for (mode = 0x14; mode <= 0x7f; mode++) { | 81 | for (mode = 0x14; mode <= 0x7f; mode++) { |
82 | if (heap_free() < sizeof(struct mode_info)) | 82 | if (!heap_free(sizeof(struct mode_info))) |
83 | break; | 83 | break; |
84 | 84 | ||
85 | if (mode_defined(VIDEO_FIRST_BIOS+mode)) | 85 | if (mode_defined(VIDEO_FIRST_BIOS+mode)) |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 192190710710..4716b9a96357 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -57,7 +57,7 @@ static int vesa_probe(void) | |||
57 | while ((mode = rdfs16(mode_ptr)) != 0xffff) { | 57 | while ((mode = rdfs16(mode_ptr)) != 0xffff) { |
58 | mode_ptr += 2; | 58 | mode_ptr += 2; |
59 | 59 | ||
60 | if (heap_free() < sizeof(struct mode_info)) | 60 | if (!heap_free(sizeof(struct mode_info))) |
61 | break; /* Heap full, can't save mode info */ | 61 | break; /* Heap full, can't save mode info */ |
62 | 62 | ||
63 | if (mode & ~0x1ff) | 63 | if (mode & ~0x1ff) |
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index e4ba897bf9a3..ad9712f01739 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -371,7 +371,7 @@ static void save_screen(void) | |||
371 | saved.curx = boot_params.screen_info.orig_x; | 371 | saved.curx = boot_params.screen_info.orig_x; |
372 | saved.cury = boot_params.screen_info.orig_y; | 372 | saved.cury = boot_params.screen_info.orig_y; |
373 | 373 | ||
374 | if (heap_free() < saved.x*saved.y*sizeof(u16)+512) | 374 | if (!heap_free(saved.x*saved.y*sizeof(u16)+512)) |
375 | return; /* Not enough heap to save the screen */ | 375 | return; /* Not enough heap to save the screen */ |
376 | 376 | ||
377 | saved.data = GET_HEAP(u16, saved.x*saved.y); | 377 | saved.data = GET_HEAP(u16, saved.x*saved.y); |