media: firewire: Using uninitialized values in node_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 May 2020 14:40:22 +0000 (16:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 07:48:08 +0000 (09:48 +0200)
commitfaff4562a4f6b1ded4fee75abeb52c6a23d8cfc8
treebea217f9a6115a589b7eb1a23106a920749852f6
parentff9e162946e1b8051ffe357994d382077d909b2e
media: firewire: Using uninitialized values in node_probe()

[ Upstream commit 2505a210fc126599013aec2be741df20aaacc490 ]

If fw_csr_string() returns -ENOENT, then "name" is uninitialized.  So
then the "strlen(model_names[i]) <= name_len" is true because strlen()
is unsigned and -ENOENT is type promoted to a very high positive value.
Then the "strncmp(name, model_names[i], name_len)" uses uninitialized
data because "name" is uninitialized.

Fixes: 92374e886c75 ("[media] firedtv: drop obsolete backend abstraction")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/firewire/firedtv-fw.c