summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorPeter Seiderer <ps.report@gmx.net>2015-03-24 18:30:47 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-10 15:03:52 +0200
commita7f933a56908587e30539d649a9ae808d0601bc5 (patch)
tree4521009abd86499cd1eb7a4b45f665c65fe96525 /drivers/media
parent[media] coda: bitrate can only be set in kbps steps (diff)
downloadlinux-a7f933a56908587e30539d649a9ae808d0601bc5.tar.xz
linux-a7f933a56908587e30539d649a9ae808d0601bc5.zip
[media] coda: check kasprintf return value in coda_open
kasprintf might fail if free memory is low. Signed-off-by: Peter Seiderer <ps.report@gmx.net> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/coda/coda-common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index ddbed9b4ae41..c82ce562d95a 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1628,6 +1628,11 @@ static int coda_open(struct file *file)
set_bit(idx, &dev->instance_mask);
name = kasprintf(GFP_KERNEL, "context%d", idx);
+ if (!name) {
+ ret = -ENOMEM;
+ goto err_coda_name_init;
+ }
+
ctx->debugfs_entry = debugfs_create_dir(name, dev->debugfs_root);
kfree(name);
@@ -1742,6 +1747,7 @@ err_pm_get:
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);
clear_bit(ctx->idx, &dev->instance_mask);
+err_coda_name_init:
err_coda_max:
kfree(ctx);
return ret;