media: visl: check if ctx->tpg_str_buf allocation failed
Subsystems (2)
PATCH 1/1 media: visl: check if ctx->tpg_str_buf allocation failed
The result of ctx->tpg_str_buf = kzalloc(TPG_STR_BUF_SZ, GFP_KERNEL); was never checked. Add this.
Signed-off-by Hans Verkuil <[email protected]>
---
drivers/media/test-drivers/visl/visl-core.c +4 -0
@@ -339,6 +339,10 @@ static int visl_open(struct file *file) } ctx->tpg_str_buf =kzalloc (TPG_STR_BUF_SZ ,GFP_KERNEL ); +if (!ctx->tpg_str_buf) { + rc = -ENOMEM ; + goto free_ctx; + }v4l2_fh_init (&ctx->fh,video_devdata (file)); ctx->dev = dev;