Files
linux/drivers/gpu/drm
Gustavo A. R. Silva d4b9dd5007 qxl: Use struct_size() in kzalloc()
One of the more common cases of allocation size calculations is finding the
size of a structure that has a zero-sized array at the end, along with memory
for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can now
use the new struct_size() helper:

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190108162152.GA25361@embeddedor
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-01-09 09:38:49 +01:00
..
2018-09-09 14:19:18 +02:00
2018-12-20 13:25:28 +01:00
2018-11-28 09:31:07 -08:00
2019-01-09 09:38:49 +01:00
2018-12-17 10:51:20 +01:00
2018-12-12 11:56:45 +01:00
2019-01-02 11:37:11 +02:00
2018-11-20 14:56:18 +01:00
2018-11-20 14:56:18 +01:00
2018-10-04 11:03:34 +10:00