summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-05-31 11:46:49 +0200
committerTakashi Iwai <tiwai@suse.de>2019-05-31 11:46:49 +0200
commita2d4560f0be9a48cd342992fbec0688ea05d564b (patch)
treeb59bf25fce1cbee0f0b976cc2a0eb766ab6a566d /sound/pci
parent65be9580885e4c14af1448b5bac95517c52a7ad3 (diff)
ALSA: hda: Use struct_size()
For code simplification and safety, use struct_size() macro for calculating the hda_conn_list object size with the variable array. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index b20eb7fc83eb..d0f1dbcfbda4 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -122,7 +122,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,
{
struct hda_conn_list *p;
- p = kmalloc(sizeof(*p) + len * sizeof(hda_nid_t), GFP_KERNEL);
+ p = kmalloc(struct_size(p, conns, len), GFP_KERNEL);
if (!p)
return -ENOMEM;
p->len = len;