From 9cb814fd3a9b2fbc38ef292b50eeb08b739ec1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Jul 2012 19:14:41 +0100 Subject: [PATCH] Fix gcc-4.7 warnings (promoted to errors by -Werror). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../../lib/metalkit/bios.c: In function ‘BIOSCallInternal’: ../../lib/metalkit/bios.c:142:25: error: integer overflow in expression [-Werror=overflow] ../../lib/metalkit/bios.c: In function ‘BIOS_Call’: ../../lib/metalkit/bios.c:242:11: error: integer overflow in expression [-Werror=overflow] ../../lib/metalkit/bios.c:247:17: error: integer overflow in expression [-Werror=overflow] Thanks to Vinson Lee for reporting it. Reviewed-by: Kurt Daverman --- lib/metalkit/bios.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/metalkit/bios.c b/lib/metalkit/bios.c index 7d517c6..9342bc1 100644 --- a/lib/metalkit/bios.c +++ b/lib/metalkit/bios.c @@ -139,7 +139,7 @@ BIOSCallInternal(void) asm volatile("xorw %%ax, %%ax \n" "mov %%ax, %%ss \n" "mov %0, %%esp \n" - :: "i" (&BIOS_SHARED->stackTop[-sizeof(Regs)])); + :: "i" (BIOS_SHARED->stackTop - sizeof(Regs))); /* * Pop Regs off the stack. @@ -239,12 +239,12 @@ BIOS_Call(uint8 vector, Regs *regs) /* * Copy Regs onto the top of the 16-bit stack. */ - memcpy(&BIOS_SHARED->stackTop[-sizeof *regs], regs, sizeof *regs); + memcpy(BIOS_SHARED->stackTop - sizeof *regs, regs, sizeof *regs); BIOSCallInternal(); /* Copy Regs back */ - memcpy(regs, &BIOS_SHARED->stackTop[-sizeof *regs], sizeof *regs); + memcpy(regs, BIOS_SHARED->stackTop - sizeof *regs, sizeof *regs); /* * Back to 32-bit IDT.