[Devel] [PATCH RHEL8 COMMIT] ploop: Do not allocate excess memory on add_delta

Konstantin Khorenko khorenko at virtuozzo.com
Tue Dec 10 18:07:37 MSK 2019


The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.6
------>
commit 029e93b1548af6547afbd04fa5382ed9b4ba5c73
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Dec 10 18:07:35 2019 +0300

    ploop: Do not allocate excess memory on add_delta
    
    Here must be sizeof(struct file *) instead of sizeof(struct file).
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 8c94fcf4bb67..86e6804037ba 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -591,10 +591,10 @@ int ploop_add_delta(struct ploop *ploop, const char *arg)
 		goto out;
 
 	ret = -ENOMEM;
-	deltas = kcalloc(level + 1, sizeof(*file), GFP_KERNEL);
+	deltas = kcalloc(level + 1, sizeof(*deltas), GFP_KERNEL);
 	if (!deltas)
 		goto out;
-	size = level * sizeof(*file);
+	size = level * sizeof(*deltas);
 	memcpy(deltas, ploop->deltas, size);
 	deltas[level] = file;
 	/*



More information about the Devel mailing list