summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-01-11 14:39:44 +0100
committerSasha Levin <alexander.levin@microsoft.com>2018-03-04 10:28:29 -0500
commit4974179d68b6d8ce0cb44f87de3506d2d102d724 (patch)
tree019f8f190d41119605d7d6f17c07d3c458f86439 /sound
parentf6af9f01e564b430d8a5ab4f927b0ccbebd486d7 (diff)
ALSA: hda/ca0132 - fix possible NULL pointer use
[ Upstream commit 46a049dae771b95e77ac6c823330f4a60f600236 ] gcc-7 caught what it considers a NULL pointer dereference: sound/pci/hda/patch_ca0132.c: In function 'dspio_scp.constprop': sound/pci/hda/patch_ca0132.c:1487:4: error: argument 1 null where non-null expected [-Werror=nonnull] This is plausible from looking at the function, as we compare 'reply' to NULL earlier in it. I have not tried to analyze if there are constraints that make it impossible to hit the bug, but adding another NULL check in the end kills the warning and makes the function more robust. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_ca0132.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 0374bd5b61c8..1fb951225318 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -1452,6 +1452,9 @@ static int dspio_scp(struct hda_codec *codec,
} else if (ret_size != reply_data_size) {
codec_dbg(codec, "RetLen and HdrLen .NE.\n");
return -EINVAL;
+ } else if (!reply) {
+ codec_dbg(codec, "NULL reply\n");
+ return -EINVAL;
} else {
*reply_len = ret_size*sizeof(unsigned int);
memcpy(reply, scp_reply.data, *reply_len);