From: Dan Carpenter <dan.carpenter@oracle.com>
To: xkernel.wang@foxmail.com
Cc: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
phil@philpotter.co.uk, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] staging: r8188eu: fix potential memory leak in _rtw_init_xmit_priv()
Date: Thu, 31 Mar 2022 14:23:12 +0300 [thread overview]
Message-ID: <20220331112312.GO3293@kadam> (raw)
In-Reply-To: <tencent_A5280DFCCB827030EBE73673F0510084970A@qq.com>
On Thu, Mar 31, 2022 at 06:58:16PM +0800, xkernel.wang@foxmail.com wrote:
> +free_xmit_extbuf:
> + pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
> + while (i-- > 0) {
> + rtw_os_xmit_resource_free(padapter, pxmitbuf, (max_xmit_extbuf_size + XMITBUF_ALIGN_SZ));
> + pxmitbuf++;
> + }
> + vfree(pxmitpriv->pallocated_xmit_extbuf);
> + i = NR_XMITBUFF;
> +free_xmitbuf:
> + pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
> + while (i-- > 0) {
> + rtw_os_xmit_resource_free(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ));
> + pxmitbuf++;
> + }
This works... Presumably, it applies to staging-next even though it
doesn't apply to linux-next. So:
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
In an ideal world, pxmitpriv->pxmitbuf would be declared as an array of
struct instead of an array of u8. That would make it much simpler
because we could do
free_xmit_extbuf:
while (--i >= 0)
rtw_os_xmit_resource_free(pxmitpriv->pxmit_extbuf[i]);
vfree(pxmitpriv->pxmit_extbuf);
i = NR_XMITBUFF;
free_xmitbuf:
while (--i >= 0)
rtw_os_xmit_resource_free(pxmitpriv->pxmitbuf[i]);
regards,
dan carpenter
next prev parent reply other threads:[~2022-03-31 11:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 10:56 [PATCH v2 1/2] staging: r8188eu: check the return of kzalloc() xkernel.wang
2022-03-31 10:58 ` [PATCH v2 2/2] staging: r8188eu: fix potential memory leak in _rtw_init_xmit_priv() xkernel.wang
2022-03-31 11:23 ` Dan Carpenter [this message]
2022-03-31 12:14 ` Xiaoke Wang
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=20220331112312.GO3293@kadam \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=phil@philpotter.co.uk \
--cc=xkernel.wang@foxmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox