projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
65be958
)
ALSA: hda: Use struct_size()
author
Takashi Iwai
<tiwai@suse.de>
Fri, 31 May 2019 09:46:49 +0000
(11:46 +0200)
committer
Takashi Iwai
<tiwai@suse.de>
Fri, 31 May 2019 09:46:49 +0000
(11:46 +0200)
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>
sound/pci/hda/hda_codec.c
patch
|
blob
|
history
diff --git
a/sound/pci/hda/hda_codec.c
b/sound/pci/hda/hda_codec.c
index
b20eb7f
..
d0f1dbc
100644
(file)
--- 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(s
izeof(*p) + len * sizeof(hda_nid_t
), GFP_KERNEL);
+ p = kmalloc(s
truct_size(p, conns, len
), GFP_KERNEL);
if (!p)
return -ENOMEM;
p->len = len;