Skip to content

Commit e889a31

Browse files
Johnny Liuthierryreding
authored andcommitted
gpu: host1x: Correct allocated size for contexts
Original implementation over allocates the memory size for the contexts list. The size of memory for the contexts list is based on the number of iommu groups specified in the device tree. Fixes: 8aa5bcb ("gpu: host1x: Add context device management code") Signed-off-by: Johnny Liu <[email protected]> Signed-off-by: Mikko Perttunen <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f017f1e commit e889a31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/host1x/context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ int host1x_memory_context_list_init(struct host1x *host1x)
3434
if (err < 0)
3535
return 0;
3636

37-
cdl->devs = kcalloc(err, sizeof(*cdl->devs), GFP_KERNEL);
37+
cdl->len = err / 4;
38+
cdl->devs = kcalloc(cdl->len, sizeof(*cdl->devs), GFP_KERNEL);
3839
if (!cdl->devs)
3940
return -ENOMEM;
40-
cdl->len = err / 4;
4141

4242
for (i = 0; i < cdl->len; i++) {
4343
ctx = &cdl->devs[i];

0 commit comments

Comments
 (0)