lkml.org 
[lkml]   [2021]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/30] v4l: vxd-dec: Create vxd_dec Mem Manager helper library
On Wed, Aug 18, 2021 at 07:40:10PM +0530, sidraya.bj@pathpartnertech.com wrote:
> +int img_mem_create_ctx(struct mem_ctx **new_ctx)
> +{
> + struct mem_man *mem_man = &mem_man_data;
> + struct mem_ctx *ctx;
> +
> + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> + if (!ctx)
> + return -ENOMEM;
> +
> + ctx->buffers = kzalloc(sizeof(*ctx->buffers), GFP_KERNEL);
> + if (!ctx->buffers)
> + return -ENOMEM;

Smatch would have caught that this needs a kfree(ctx); before returning.

It wouldn't hurt to run Smatch over this code.

git clone https://repo.or.cz/w/smatch.git
cd smatch
yum install gcc make sqlite3 sqlite-devel sqlite perl-DBD-SQLite openssl-devel perl-Try-Tiny
make
cd ~/kernel/
~/smatch/smatch_scripts/kchecker drivers/staging/media/vxd/common/img_mem_man.c

(I am the author of Smatch #BlowYourOwnTrumpet).

regards,
dan carpenter

\
 
 \ /
  Last update: 2021-08-24 15:37    [W:0.346 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site