Thread (11 messages) flat view 11 messages, 2 authors, 2020-11-10
STALE2127d REVIEWED: 3 (3M)

1 review trailer (1 from subsystem maintainers).

[PATCH v3 9/9] dma-buf: use krealloc_array()

From: Bartosz Golaszewski <hidden>
Date: 2020-11-09 11:07:21
Also in: alsa-devel, dri-devel, kvm, linux-edac, linux-gpio, linux-media, linux-mm, lkml
Subsystem: dma buffer sharing framework, sync file framework, the rest · Maintainers: Sumit Semwal, Christian König, Linus Torvalds

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>
---
 drivers/dma-buf/sync_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 5a5a1da01a00..20d9bddbb985 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -270,8 +270,7 @@ 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;
 
-- 
2.29.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help