Make memmove copy (dev->resources -i) resource structs instead of

(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
This commit is contained in:
Myles Watson 2009-05-28 21:57:11 +00:00
parent 7365004424
commit f9f4eaf7ab
1 changed files with 2 additions and 1 deletions

View File

@ -272,7 +272,8 @@ void compact_resources(device_t dev)
for(i = 0; i < dev->resources;) { for(i = 0; i < dev->resources;) {
resource = &dev->resource[i]; resource = &dev->resource[i];
if (!resource->flags) { if (!resource->flags) {
memmove(resource, resource + 1, dev->resources - i); memmove(resource, resource + 1, (dev->resources - i) *
sizeof(*resource));
dev->resources -= 1; dev->resources -= 1;
memset(&dev->resource[dev->resources], 0, sizeof(*resource)); memset(&dev->resource[dev->resources], 0, sizeof(*resource));
} else { } else {