Re: [PATCH 03/30] v4l: vxd-dec: Create vxd_dec Mem Manager helper library

From: Sidraya Jayagond
Date: Mon Sep 13 2021 - 23:40:47 EST


On Tue, Aug 24, 2021 at 04:34:38PM +0300, Dan Carpenter wrote:
> On Wed, Aug 18, 2021 at 07:40:10PM +0530, sidraya.bj@xxxxxxxxxxxxxxxxxxx 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
>
I will run Smatch and will remove similar findings.
Thank you for reviewing.

--






This
message contains confidential information and is intended only
for the
individual(s) named. If you are not the intended
recipient, you are
notified that disclosing, copying, distributing or taking any
action in
reliance on the contents of this mail and attached file/s is strictly
prohibited. Please notify the
sender immediately and delete this e-mail
from your system. E-mail transmission
cannot be guaranteed to be secured or
error-free as information could be
intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain
viruses. The sender therefore does
not accept liability for any errors or
omissions in the contents of this
message, which arise as a result of e-mail
transmission.