Skip to content

Commit 2505a21

Browse files
Dan Carpentermchehab
authored andcommitted
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: 92374e8 ("[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>
1 parent 2017172 commit 2505a21

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/media/firewire/firedtv-fw.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
272272

273273
name_len = fw_csr_string(unit->directory, CSR_MODEL,
274274
name, sizeof(name));
275+
if (name_len < 0)
276+
return name_len;
275277
for (i = ARRAY_SIZE(model_names); --i; )
276278
if (strlen(model_names[i]) <= name_len &&
277279
strncmp(name, model_names[i], name_len) == 0)

0 commit comments

Comments
 (0)