All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nam Cao <namcaov@gmail.com>, Ji-Hun Kim <ji_hun.kim@samsung.com>
Cc: forest@alittletooquiet.net, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH] staging: vt6655: fix potential memory leak
Date: Mon, 12 Sep 2022 16:25:02 +0300	[thread overview]
Message-ID: <Yx8zLugepoJkJjHj@kadam> (raw)
In-Reply-To: <20220909141338.19343-1-namcaov@gmail.com>

On Fri, Sep 09, 2022 at 04:13:39PM +0200, Nam Cao wrote:
> In function device_init_td0_ring, memory is allocated for member
> td_info of priv->apTD0Rings[i], with i increasing from 0. In case of
> allocation failure, the memory is freed in reversed order, with i
> decreasing to 0. However, the case i=0 is left out and thus memory is
> leaked.
> 
> Modify the memory freeing loop to include the case i=0.
> 
> Signed-off-by: Nam Cao <namcaov@gmail.com>

Looks good.  Please add a Fixes tag, and CC all the people who were
involved with the original patch so they can review it.

Fixes: 5341ee0adb17 ("staging: vt6655: check for memory allocation failures")

I actually wrote that buggy code and Ji-Hun copied it from me, so my
bad.  Sorry!

regards,
dan carpenter


      parent reply	other threads:[~2022-09-12 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 14:13 [PATCH] staging: vt6655: fix potential memory leak Nam Cao
2022-09-09 14:42 ` Nam Cao
2022-09-12 14:17   ` Dan Carpenter
2022-09-12 14:53     ` Dan Carpenter
2022-09-09 17:59 ` Philipp Hortmann
2022-09-12 13:25 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yx8zLugepoJkJjHj@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ji_hun.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=namcaov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.