linux/drivers/gpu/drm/vc4
Gustavo A. R. Silva 1eb6ea4a82 drm/vc4: 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) + count * sizeof(struct boo), 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>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190131010015.GA32272@embeddedor
2019-02-06 15:16:08 -08:00
..
Kconfig
Makefile
vc4_bo.c
vc4_crtc.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_debugfs.c
vc4_dpi.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_drv.c drm/irq: Don't check for DRIVER_HAVE_IRQ in drm_irq_(un)install 2019-01-29 15:45:06 +01:00
vc4_drv.h drm: move drm_can_sleep() to drm_util.h 2019-01-14 10:58:37 +01:00
vc4_dsi.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_fence.c
vc4_gem.c drm: revert "expand replace_fence to support timeline point v2" 2018-12-05 11:01:11 +01:00
vc4_hdmi.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_hvs.c
vc4_irq.c
vc4_kms.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_packet.h
vc4_perfmon.c drm/vc4: Use struct_size() in kzalloc() 2019-02-06 15:16:08 -08:00
vc4_plane.c drm/vc4: Limit SAND tiling support to semiplanar YUV420 formats 2019-01-11 16:53:08 +01:00
vc4_qpu_defines.h
vc4_regs.h drm/vc4: Define missing PITCH0_SINK_PIX field 2018-10-24 17:58:08 +02:00
vc4_render_cl.c
vc4_trace.h
vc4_trace_points.c
vc4_txp.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
vc4_v3d.c
vc4_validate.c
vc4_validate_shaders.c
vc4_vec.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00