diff mbox

[01/24] petitboot: Fix memmove size

Message ID 20090413011136.561095822@am.sony.com
State Accepted
Headers show

Commit Message

Geoff Levand April 13, 2009, 1:11 a.m. UTC
Correct the byte count for several memmove calls.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 lib/waiter/waiter.c         |    3 ++-
 ui/common/discover-client.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

--- a/lib/waiter/waiter.c
+++ b/lib/waiter/waiter.c
@@ -43,7 +43,8 @@  void waiter_remove(struct waiter *waiter
 	assert(i >= 0 && i < n_waiters);
 
 	n_waiters--;
-	memmove(&waiters[i], &waiters[i+1], n_waiters - i);
+	memmove(&waiters[i], &waiters[i+1],
+		(n_waiters - i) * sizeof(waiters[0]));
 
 	waiters = talloc_realloc(NULL, waiters, struct waiter, n_waiters);
 }
--- a/ui/common/discover-client.c
+++ b/ui/common/discover-client.c
@@ -111,7 +111,7 @@  static void device_remove(struct discove
 	/* remove the device from the client's device array */
 	client->n_devices--;
 	memmove(&client->devices[i], &client->devices[i+1],
-			client->n_devices - i);
+			(client->n_devices - i) * sizeof(client->devices[0]));
 	client->devices = talloc_realloc(client, client->devices,
 			struct device *, client->n_devices);