coresight: core: Switch to krealloc_array()
PATCH 1/1 coresight: core: Switch to krealloc_array()
Let the krealloc_array() check for multiplication overflow.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/hwtracing/coresight/coresight-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +3 -3
@@ -1730,9 +1730,9 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,if (idx <0 ) {/* Make space for the new entry */ idx = dict->nr_idx; - list =krealloc (dict->fwnode_list, - (idx +1 ) *sizeof (*dict->fwnode_list), -GFP_KERNEL ); + list =krealloc_array (dict->fwnode_list, + idx +1 ,sizeof (*dict->fwnode_list), +GFP_KERNEL );if (ZERO_OR_NULL_PTR (list)) { idx = -ENOMEM ; goto done;
Signature · 1 line
2.30.2
Quoted 12 lines · Andy Shevchenko
Let the
krealloc_array()check for multiplication overflow.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/hwtracing/coresight/coresight-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-core.c +0
-0
drivers/hwtracing/coresight/coresight-core.c char *coresight_alloc_device_name(struct coresight_dev_list *dict, · line 1735
Quoted 9 lines
drivers/hwtracing/coresight/coresight-core.c +3
-3@@ -1730,9 +1730,9 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,if (idx <0 ) {/* Make space for the new entry */ idx = dict->nr_idx; - list =krealloc (dict->fwnode_list, - (idx +1 ) *sizeof (*dict->fwnode_list), -GFP_KERNEL ); + list =krealloc_array (dict->fwnode_list, + idx +1 ,sizeof (*dict->fwnode_list), +GFP_KERNEL );
Applied - thanks.
Mathieu
Quoted 6 lines
drivers/hwtracing/coresight/coresight-core.c +0
-0if (ZERO_OR_NULL_PTR (list)) { idx = -ENOMEM ; goto done;Signature · 1 line
2.30.2