Commit a2d4560f authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 65be9580
...@@ -122,7 +122,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, ...@@ -122,7 +122,7 @@ static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len,
{ {
struct hda_conn_list *p; 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) if (!p)
return -ENOMEM; return -ENOMEM;
p->len = len; p->len = len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment