From: Peter Seiderer Date: Tue, 24 Mar 2015 17:30:47 +0000 (-0300) Subject: [media] coda: check kasprintf return value in coda_open X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a7f933a56908587e30539d649a9ae808d0601bc5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] coda: check kasprintf return value in coda_open kasprintf might fail if free memory is low. Signed-off-by: Peter Seiderer Signed-off-by: Philipp Zabel Signed-off-by: Kamil Debski Signed-off-by: Mauro Carvalho Chehab --- 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;