Make memmove copy (dev->resources -i) resource structs instead of
authorMyles Watson <mylesgw@gmail.com>
Thu, 28 May 2009 21:57:11 +0000 (21:57 +0000)
committerMyles Watson <mylesgw@gmail.com>
Thu, 28 May 2009 21:57:11 +0000 (21:57 +0000)
(dev->resources-i) bytes in compact_resources.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4319 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/devices/device_util.c

index 692e40c6b0821ee1e27c3d3c9af2caf1d7899933..aa23a2b34c355f565c0cbc02c6908b208e09b00c 100644 (file)
@@ -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 {