]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: visl: check if ctx->tpg_str_buf allocation failed
authorHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 12 May 2026 06:46:15 +0000 (08:46 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 12 May 2026 07:39:03 +0000 (09:39 +0200)
The result of ctx->tpg_str_buf = kzalloc(TPG_STR_BUF_SZ, GFP_KERNEL); was
never checked. Add this.

Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/test-drivers/visl/visl-core.c

index 127ab18bce99fcb73754f57fa2c86962c3d288f6..5e9bdd425d4a307639a5a61b68e8aa3430cd42d2 100644 (file)
@@ -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;