diff options
author | Peter Seiderer <ps.report@gmx.net> | 2015-03-24 13:30:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-10 09:03:52 -0400 |
commit | a7f933a56908587e30539d649a9ae808d0601bc5 (patch) | |
tree | 4521009abd86499cd1eb7a4b45f665c65fe96525 /drivers/media/platform | |
parent | 92b042ecedea7aa3d47391be57411709dab52cd7 (diff) |
[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/platform')
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 6 |
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) | |||
1628 | set_bit(idx, &dev->instance_mask); | 1628 | set_bit(idx, &dev->instance_mask); |
1629 | 1629 | ||
1630 | name = kasprintf(GFP_KERNEL, "context%d", idx); | 1630 | name = kasprintf(GFP_KERNEL, "context%d", idx); |
1631 | if (!name) { | ||
1632 | ret = -ENOMEM; | ||
1633 | goto err_coda_name_init; | ||
1634 | } | ||
1635 | |||
1631 | ctx->debugfs_entry = debugfs_create_dir(name, dev->debugfs_root); | 1636 | ctx->debugfs_entry = debugfs_create_dir(name, dev->debugfs_root); |
1632 | kfree(name); | 1637 | kfree(name); |
1633 | 1638 | ||
@@ -1742,6 +1747,7 @@ err_pm_get: | |||
1742 | v4l2_fh_del(&ctx->fh); | 1747 | v4l2_fh_del(&ctx->fh); |
1743 | v4l2_fh_exit(&ctx->fh); | 1748 | v4l2_fh_exit(&ctx->fh); |
1744 | clear_bit(ctx->idx, &dev->instance_mask); | 1749 | clear_bit(ctx->idx, &dev->instance_mask); |
1750 | err_coda_name_init: | ||
1745 | err_coda_max: | 1751 | err_coda_max: |
1746 | kfree(ctx); | 1752 | kfree(ctx); |
1747 | return ret; | 1753 | return ret; |