File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -98,12 +98,17 @@ static void dma_resv_list_set(struct dma_resv_list *list,
98
98
static struct dma_resv_list * dma_resv_list_alloc (unsigned int max_fences )
99
99
{
100
100
struct dma_resv_list * list ;
101
+ size_t size ;
101
102
102
- list = kmalloc (struct_size (list , table , max_fences ), GFP_KERNEL );
103
+ /* Round up to the next kmalloc bucket size. */
104
+ size = kmalloc_size_roundup (struct_size (list , table , max_fences ));
105
+
106
+ list = kmalloc (size , GFP_KERNEL );
103
107
if (!list )
104
108
return NULL ;
105
109
106
- list -> max_fences = (ksize (list ) - offsetof(typeof (* list ), table )) /
110
+ /* Given the resulting bucket size, recalculated max_fences. */
111
+ list -> max_fences = (size - offsetof(typeof (* list ), table )) /
107
112
sizeof (* list -> table );
108
113
109
114
return list ;
You can’t perform that action at this time.
0 commit comments