linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] coresight: core: Switch to krealloc_array()
@ 2021-05-20 13:50 Andy Shevchenko
  2021-05-21 16:10 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-05-20 13:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathieu Poirier, coresight, linux-arm-kernel,
	linux-kernel
  Cc: Suzuki K Poulose, Mike Leach, Leo Yan, Alexander Shishkin,
	Andy Shevchenko

Let the krealloc_array() check for multiplication overflow.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 6c68d34d956e..a7971c68b0be 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -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;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] coresight: core: Switch to krealloc_array()
  2021-05-20 13:50 [PATCH v1 1/1] coresight: core: Switch to krealloc_array() Andy Shevchenko
@ 2021-05-21 16:10 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2021-05-21 16:10 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, coresight, linux-arm-kernel, linux-kernel,
	Suzuki K Poulose, Mike Leach, Leo Yan, Alexander Shishkin

On Thu, May 20, 2021 at 04:50:41PM +0300, Andy Shevchenko wrote:
> Let the krealloc_array() check for multiplication overflow.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/hwtracing/coresight/coresight-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index 6c68d34d956e..a7971c68b0be 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -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

>  		if (ZERO_OR_NULL_PTR(list)) {
>  			idx = -ENOMEM;
>  			goto done;
> -- 
> 2.30.2
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-21 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 13:50 [PATCH v1 1/1] coresight: core: Switch to krealloc_array() Andy Shevchenko
2021-05-21 16:10 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).