]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
altera-stapl: check for a null key before strcasecmp'ing it
authorColin Ian King <colin.king@canonical.com>
Sat, 24 Nov 2018 12:34:10 +0000 (12:34 +0000)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:14 +0000 (14:22 -0300)
commit5f5ab204ca509e526cd467a5528455059ae60b6b
treeaea843e211b797050504b651691d35a112b64963
parent1f0c6b57300a68c37bd530efc3056db3e57c93b9
altera-stapl: check for a null key before strcasecmp'ing it

BugLink: https://bugs.launchpad.net/bugs/1857158
[ Upstream commit 9ccb645683ef46e3c52c12c088a368baa58447d4 ]

Currently the null check on key is occurring after the strcasecmp on
the key, hence there is a potential null pointer dereference on key.
Fix this by checking if key is null first. Also replace the == 0
check on strcasecmp with just the ! operator.

Detected by CoverityScan, CID#1248787 ("Dereference before null check")

Fixes: fa766c9be58b ("[media] Altera FPGA firmware download module")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/misc/altera-stapl/altera.c