--- x/mm/damon/dbgfs.c
+++ d/mm/damon/dbgfs.c
@@ -905,14 +905,14 @@ static int dbgfs_rm_context(char *name)
 	if (!dir)
 		return -ENOENT;
 
-	new_dirs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs),
+	new_dirs = kmalloc_array(dbgfs_nr_ctxs, sizeof(*dbgfs_dirs),
 			GFP_KERNEL);
 	if (!new_dirs) {
 		ret = -ENOMEM;
 		goto out_dput;
 	}
 
-	new_ctxs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_ctxs),
+	new_ctxs = kmalloc_array(dbgfs_nr_ctxs, sizeof(*dbgfs_ctxs),
 			GFP_KERNEL);
 	if (!new_ctxs) {
 		ret = -ENOMEM;