[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210824133438.GO1931@kadam>
Date: Tue, 24 Aug 2021 16:34:38 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: sidraya.bj@...hpartnertech.com
Cc: gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, prashanth.ka@...hpartnertech.com,
praneeth@...com, mchehab@...nel.org, linux-media@...r.kernel.org,
praveen.ap@...hpartnertech.com
Subject: Re: [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@...hpartnertech.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
Powered by blists - more mailing lists