lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 15 Nov 2021 13:36:36 +0100
From:   Jens Wiklander <jens.wiklander@...aro.org>
To:     Sumit Garg <sumit.garg@...aro.org>
Cc:     cgel.zte@...il.com, op-tee@...ts.trustedfirmware.org,
        linux-kernel@...r.kernel.org, Lv Ruyi <lv.ruyi@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] optee: fix kfree NULL pointer

On Mon, Nov 8, 2021 at 6:34 AM Sumit Garg <sumit.garg@...aro.org> wrote:
>
> On Thu, 4 Nov 2021 at 17:00, <cgel.zte@...il.com> wrote:
> >
> > From: Lv Ruyi <lv.ruyi@....com.cn>
> >
> > This patch fixes the following Coccinelle error:
> > drivers/tee/optee/ffa_abi.c: 877: ERROR  optee is NULL but dereferenced.
> >
> > If memory allocation fails, optee is null pointer. the code will goto err
> >  and release optee.
> >
> > Reported-by: Zeal Robot <zealci@....com.cn>
> > Signed-off-by: Lv Ruyi <lv.ruyi@....com.cn>
> > ---
> >  drivers/tee/optee/ffa_abi.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> > index 6defd1ec982a..8d9d189557f9 100644
> > --- a/drivers/tee/optee/ffa_abi.c
> > +++ b/drivers/tee/optee/ffa_abi.c
> > @@ -811,8 +811,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
> >
> >         optee = kzalloc(sizeof(*optee), GFP_KERNEL);
> >         if (!optee) {
> > -               rc = -ENOMEM;
> > -               goto err;
> > +               return -ENOMEM;
> >         }
>
> So the braces are redundant after this change, hence can be dropped.
>
> With that addressed:
>
> Reviewed-by: Sumit Garg <sumit.garg@...aro.org>

I'll fix up the commit and pick it up now.

Thanks,
Jens

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ