Thread (21 messages) 21 messages, 11 authors, 2020-11-05

Re: [PATCH 8/8] dma-buf: use krealloc_array()

From: Christian König <christian.koenig@amd.com>
Date: 2020-10-27 12:21:46
Also in: alsa-devel, dri-devel, kvm, linux-edac, linux-gpio, linux-media, linux-mm, lkml, virtualization

Am 27.10.20 um 13:17 schrieb Bartosz Golaszewski:
From: Bartosz Golaszewski <redacted>

Use the helper that checks for overflows internally instead of manually
calculating the size of the new array.

Signed-off-by: Bartosz Golaszewski <redacted>
Acked-by: Christian König <christian.koenig@amd.com>
quoted hunk ↗ jump to hunk
---
  drivers/dma-buf/sync_file.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 5a5a1da01a00..2925ea03eef0 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -270,8 +270,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
  		fences[i++] = dma_fence_get(a_fences[0]);
  
  	if (num_fences > i) {
-		nfences = krealloc(fences, i * sizeof(*fences),
-				  GFP_KERNEL);
+		nfences = krealloc_array(fences, i,
+					 sizeof(*fences), GFP_KERNEL);
  		if (!nfences)
  			goto err;
  
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help