From f9f4eaf7ab8c39691fc8b2019d511bdd17b27a37 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Thu, 28 May 2009 21:57:11 +0000 Subject: [PATCH] Make memmove copy (dev->resources -i) resource structs instead of (dev->resources-i) bytes in compact_resources. Signed-off-by: Myles Watson Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4319 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/device_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices/device_util.c b/src/devices/device_util.c index 692e40c6b0..aa23a2b34c 100644 --- a/src/devices/device_util.c +++ b/src/devices/device_util.c @@ -272,7 +272,8 @@ void compact_resources(device_t dev) for(i = 0; i < dev->resources;) { resource = &dev->resource[i]; if (!resource->flags) { - memmove(resource, resource + 1, dev->resources - i); + memmove(resource, resource + 1, (dev->resources - i) * + sizeof(*resource)); dev->resources -= 1; memset(&dev->resource[dev->resources], 0, sizeof(*resource)); } else {