From 196379854bc71844ffd016090268db1d1343c018 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 13 Sep 2017 09:50:46 +0900 Subject: [PATCH] Fix a few more harmless compiler warnings: - myfree in pager.c was called with an argument, so add one to the dummy definition - pgoff is offset_t (unsigned) and doesn't need to be compared to 0 - clang says '*(int *)0 = 0' will be optimized away instead of keeping the segfault without a volatile hint (?! that is wrong!), but it causes no harm to add anyway. --- arch/x86/kernel/vsyscall.c | 2 +- kernel/pager.c | 2 +- kernel/syscall.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/vsyscall.c b/arch/x86/kernel/vsyscall.c index 12e2d2cb..1de7c452 100644 --- a/arch/x86/kernel/vsyscall.c +++ b/arch/x86/kernel/vsyscall.c @@ -102,7 +102,7 @@ int vsyscall_gettimeofday(struct timeval *tv, void *tz) : "%rcx", "%r11", "memory"); if (error) { - *(int *)0 = 0; /* i.e. raise(SIGSEGV) */ + *(volatile int *)0 = 0; /* i.e. raise(SIGSEGV) */ } return error; } /* vsyscall_gettimeofday() */ diff --git a/kernel/pager.c b/kernel/pager.c index 4fddd650..d997f208 100644 --- a/kernel/pager.c +++ b/kernel/pager.c @@ -161,7 +161,7 @@ myalloc(struct swapinfo *si, size_t sz) } void -myfree() +myfree(void *p) { /* nothing so far */ } diff --git a/kernel/syscall.c b/kernel/syscall.c index 162f0e3e..a932215b 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -7589,7 +7589,7 @@ SYSCALL_DECLARE(remap_file_pages) ihk_mc_spinlock_lock_noirq(&thread->vm->memory_range_lock); #define PGOFF_LIMIT ((off_t)1 << ((8*sizeof(off_t) - 1) - PAGE_SHIFT)) if ((size <= 0) || (size & (PAGE_SIZE - 1)) || (prot != 0) - || (pgoff < 0) || (PGOFF_LIMIT <= pgoff) + || (PGOFF_LIMIT <= pgoff) || ((PGOFF_LIMIT - pgoff) < (size / PAGE_SIZE)) || !((start < end) || (end == 0))) { ekprintf("sys_remap_file_pages(%#lx,%#lx,%#x,%#lx,%#x):"