remoteproc: fix off-by-one bug in __rproc_free_vrings
authorSubramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
Sun, 13 May 2012 13:28:02 +0000 (16:28 +0300)
committerOhad Ben-Cohen <ohad@wizery.com>
Sun, 13 May 2012 20:15:42 +0000 (23:15 +0300)
Fix a nasty off-by-one bug in __rproc_free_vrings which
resulted in a memory leak and (for some platforms) failures
to reload the remote processor.

Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
[ohad@wizery.com: reword commit log, stick with the for loop]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
drivers/remoteproc/remoteproc_core.c

index ee15c68fb5192cfb03ac9cb2207be17bbc17abc0..e756a0df3664e0dd60ee8129449840347b5bdf42 100644 (file)
@@ -354,7 +354,7 @@ static void __rproc_free_vrings(struct rproc_vdev *rvdev, int i)
 {
        struct rproc *rproc = rvdev->rproc;
 
-       for (i--; i > 0; i--) {
+       for (i--; i >= 0; i--) {
                struct rproc_vring *rvring = &rvdev->vring[i];
                int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));