Re: [PATCH v2] drm/radeon/dpm: Replace one-element array and use struct_size() helper

2020-05-22 Thread Alex Deucher
On Fri, May 22, 2020 at 1:29 PM Gustavo A. R. Silva wrote: > > The current codebase makes use of one-element arrays in the following > form: > > struct something { > int length; > u8 data[1]; > }; > > struct something *instance; > > instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL);

[PATCH v2] drm/radeon/dpm: Replace one-element array and use struct_size() helper

2020-05-22 Thread Gustavo A. R. Silva
The current codebase makes use of one-element arrays in the following form: struct something { int length; u8 data[1]; }; struct something *instance; instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL); instance->length = size; memcpy(instance->data, source, size); but the preferre