mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
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>
This commit is contained in:
parent
65be958088
commit
a2d4560f0b
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue