From: Takashi Iwai Date: Fri, 31 May 2019 09:47:24 +0000 (+0200) Subject: ALSA: hda/ca0132: Use struct_size() X-Git-Tag: v5.3-rc1~168^2~107 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e046b64b1547e2dc1ac27e0a5ac57e55213e16f1;p=thirdparty%2Fkernel%2Flinux.git ALSA: hda/ca0132: Use struct_size() For code simplification and safety, use struct_size() macro for calculating the dsp_image_seg object size. Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index e1ebc6d5f3822..de61179c91e2c 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -2731,7 +2731,7 @@ static bool is_last(const struct dsp_image_seg *p) static size_t dsp_sizeof(const struct dsp_image_seg *p) { - return sizeof(*p) + p->count*sizeof(u32); + return struct_size(p, data, p->count); } static const struct dsp_image_seg *get_next_seg_ptr(