Re: [PATCH] media: ti-vpe: cal: Fix a NULL pointer dereference in cal_ctx_v4l2_init_formats()

From: Pratyush Yadav
Date: Thu Jan 27 2022 - 05:47:26 EST


On 25/01/22 01:20AM, Zhou Qingyang wrote:
> In cal_ctx_v4l2_init_formats(), devm_kzalloc() is assigned to fw and there
> is a dereference of it after that, which could lead to NULL pointer
> dereference on failure of devm_kzalloc().
>
> Fix this bug by adding a NULL check of ctx->active_fmt.
>
> This bug was found by a static analyzer.
>
> Builds with 'make allyesconfig' show no new warnings,
> and our static analyzer no longer warns about this code.
>
> Fixes: 7168155002cf ("media: ti-vpe: cal: Move format handling to cal.c and expose helpers")
> Signed-off-by: Zhou Qingyang <zhou1615@xxxxxxx>

Reviewed-by: Pratyush Yadav <p.yadav@xxxxxx>

--
Regards,
Pratyush Yadav
Texas Instruments Inc.