aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/boot.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-25 19:09:38 -0400
committerH. Peter Anvin <hpa@zytor.com>2007-10-25 23:20:06 -0400
commite6e1ace9904b72478f0c5a5aa7bd174cb6f62561 (patch)
tree8858fe4c1d37e4e9278020bf8fba369dfdddd2a7 /arch/x86/boot/boot.h
parent6b6815c6d5d1dc209701d1661a7a0e09a295db2f (diff)
x86 setup: sizeof() is unsigned, unbreak comparisons
We use signed values for limit checking since the values can go negative under certain circumstances. However, sizeof() is unsigned and forces the comparison to be unsigned, so move the comparison into the heap_free() macros so we can ensure it is a signed comparison. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/boot/boot.h')
-rw-r--r--arch/x86/boot/boot.h4
1 files changed, 2 insertions, 2 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
219static inline int heap_free(void) 219static 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 */