Skip to content

Commit

Permalink
dma-buf: use krealloc_array()
Browse files Browse the repository at this point in the history
Use the helper that checks for overflows internally instead of manually
calculating the size of the new array.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Christian König <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Gustavo Padovan <[email protected]>
Cc: James Morse <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: "Michael S . Tsirkin" <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Sumit Semwal <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
brgl authored and torvalds committed Dec 15, 2020
1 parent f8f7e2b commit a47fc51
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/dma-buf/sync_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a47fc51

Please sign in to comment.