Reapply "dm: always update the array size in realloc_argv on success"

This reverts commit a10c89734c.

It should now be fixed so should be safe to apply again.

Change-Id: I9e96304f5118f3bf351eb5b0cb1ef9deade2d42d
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2025-05-28 07:11:09 +00:00
parent 75ac935d8a
commit 32c69e085e

View File

@@ -501,9 +501,10 @@ static char **realloc_argv(unsigned int *size, char **old_argv)
gfp = GFP_NOIO;
}
argv = kmalloc_array(new_size, sizeof(*argv), gfp);
if (argv && old_argv) {
memcpy(argv, old_argv, *size * sizeof(*argv));
if (argv) {
*size = new_size;
if (old_argv)
memcpy(argv, old_argv, *size * sizeof(*argv));
}
kfree(old_argv);