kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] rpmsg: Avoid double-free in mtk_rpmsg_register_device()
       [not found] <9f4fb922-4aa3-0b63-6d81-c83daefd13b9@web.de>
@ 2020-09-02 11:04 ` Nicolas Boichat
  0 siblings, 0 replies; only message in thread
From: Nicolas Boichat @ 2020-09-02 11:04 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Ohad Ben-Cohen, kernel-janitors,
	open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM, lkml,
	Bjorn Andersson, moderated list:ARM/Mediatek SoC support,
	Pi-Hsun Shih, Matthias Brugger, linux-arm Mailing List

On Wed, Sep 2, 2020 at 5:33 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > If rpmsg_register_device fails, it will call
> > mtk_rpmsg_release_device which already frees mdev.
>
> Can another imperative wording become helpful for the change description?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9c7d619be5a002ea29c172df5e3c1227c22cbb41#n151

Looking at your posting history, I'll leave it up to the maintainer.

> …
> > +++ b/drivers/rpmsg/mtk_rpmsg.c
> > @@ -220,10 +220,8 @@  static int mtk_rpmsg_register_device(struct mtk_rpmsg_rproc_subdev *mtk_subdev,
> >       rpdev->dev.release = mtk_rpmsg_release_device;
> >
> >       ret = rpmsg_register_device(rpdev);
> > -     if (ret) {
> > -             kfree(mdev);
> > +     if (ret)
> >               return ret;
> > -     }
> >
> >       return 0;
> >  }
>
>
> * How do you think about to use the following code variant instead?
>
>         return rpmsg_register_device(rpdev);
>
> * Would you like to omit the variable “ret” for this function implementation?

That's a good suggestion, I'll update and send a v2.

>
> Regards,
> Markus

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-02 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9f4fb922-4aa3-0b63-6d81-c83daefd13b9@web.de>
2020-09-02 11:04 ` [PATCH] rpmsg: Avoid double-free in mtk_rpmsg_register_device() Nicolas Boichat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).