--- zzzz-none-000/linux-4.4.60/drivers/md/dm-table.c 2017-04-08 07:53:53.000000000 +0000 +++ hawkeye-5590-729/linux-4.4.60/drivers/md/dm-table.c 2022-03-30 14:21:52.000000000 +0000 @@ -464,6 +464,16 @@ struct list_head *devices = &ti->table->devices; struct dm_dev_internal *dd; + if (!ti) { + DMERR("%s: dm_target pointer is NULL", __func__); + return; + } + + if (!d) { + DMERR("%s: dm_dev pointer is NULL", __func__); + return; + } + list_for_each_entry(dd, devices, list) { if (dd->dm_dev == d) { found = 1; @@ -507,14 +517,14 @@ * On the other hand, dm-switch needs to process bulk data using messages and * excessive use of GFP_NOIO could cause trouble. */ -static char **realloc_argv(unsigned *array_size, char **old_argv) +static char **realloc_argv(unsigned *size, char **old_argv) { char **argv; unsigned new_size; gfp_t gfp; - if (*array_size) { - new_size = *array_size * 2; + if (*size) { + new_size = *size * 2; gfp = GFP_KERNEL; } else { new_size = 8; @@ -522,8 +532,8 @@ } argv = kmalloc(new_size * sizeof(*argv), gfp); if (argv) { - memcpy(argv, old_argv, *array_size * sizeof(*argv)); - *array_size = new_size; + memcpy(argv, old_argv, *size * sizeof(*argv)); + *size = new_size; } kfree(old_argv);