Skip to contentSkip to conversation

media: visl: check if ctx->tpg_str_buf allocation failed

PATCH New Hans Verkuil 1 participant 1 message May 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---

drivers/media/test-drivers/visl/visl-core.c +4 -0
index 127ab18bce99..5e9bdd425d4a 100644
@@ -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;