summaryrefslogtreecommitdiffstats
path: root/drivers/media/firewire
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-05-08 16:40:22 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-04 11:57:10 +0200
commit2505a210fc126599013aec2be741df20aaacc490 (patch)
treeffdda8d253e4c6c1ee357f677d17fa9c24d97f90 /drivers/media/firewire
parent20171723144ca0d057b72e852536992fd371369a (diff)
downloadlinux-2505a210fc126599013aec2be741df20aaacc490.tar.bz2
media: firewire: Using uninitialized values in node_probe()
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>
Diffstat (limited to 'drivers/media/firewire')
-rw-r--r--drivers/media/firewire/firedtv-fw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c
index 97144734eb05..3f1ca40b9b98 100644
--- a/drivers/media/firewire/firedtv-fw.c
+++ b/drivers/media/firewire/firedtv-fw.c
@@ -272,6 +272,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
name_len = fw_csr_string(unit->directory, CSR_MODEL,
name, sizeof(name));
+ if (name_len < 0)
+ return name_len;
for (i = ARRAY_SIZE(model_names); --i; )
if (strlen(model_names[i]) <= name_len &&
strncmp(name, model_names[i], name_len) == 0)