diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-12-25 19:47:12 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:33 -0500 |
commit | b2ad41f9ef72d7b3309a2578bf4432a262ff2b47 (patch) | |
tree | c0f57376ab77aace63f1670710baaffa79d4b8f9 /drivers/media | |
parent | f0ecba96e76295792a0b1ee2e03b505562e7b9f3 (diff) |
V4L/DVB (13953): firedtv: add missing NULL pointer check
If there is ever going to be a FireDTV or FloppyDTV firmware which does
not provide a minimal ASCII textual descriptor for Model_Id --- or if
the descriptor is provided indirectly in a descriptor directory ---
the ieee1394 variant of the device probe of firedtv would dereference a
NULL pointer. The firewire variant of firedtv's device probe is not
affected.
The fix makes sure that such an unexpected firmware is safely recognized
by fdtv_alloc as an unknown firmware.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/firewire/firedtv-1394.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-1394.c b/drivers/media/dvb/firewire/firedtv-1394.c index 7c5459c27b75..81a56293540d 100644 --- a/drivers/media/dvb/firewire/firedtv-1394.c +++ b/drivers/media/dvb/firewire/firedtv-1394.c | |||
@@ -192,9 +192,13 @@ static int node_probe(struct device *dev) | |||
192 | int kv_len, err; | 192 | int kv_len, err; |
193 | void *kv_str; | 193 | void *kv_str; |
194 | 194 | ||
195 | kv_len = (ud->model_name_kv->value.leaf.len - 2) * sizeof(quadlet_t); | 195 | if (ud->model_name_kv) { |
196 | kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv); | 196 | kv_len = (ud->model_name_kv->value.leaf.len - 2) * 4; |
197 | 197 | kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv); | |
198 | } else { | ||
199 | kv_len = 0; | ||
200 | kv_str = NULL; | ||
201 | } | ||
198 | fdtv = fdtv_alloc(dev, &fdtv_1394_backend, kv_str, kv_len); | 202 | fdtv = fdtv_alloc(dev, &fdtv_1394_backend, kv_str, kv_len); |
199 | if (!fdtv) | 203 | if (!fdtv) |
200 | return -ENOMEM; | 204 | return -ENOMEM; |