From: Greg KH <gregkh@linuxfoundation.org>
To: xkernel.wang@foxmail.com
Cc: dan.carpenter@oracle.com, Larry.Finger@lwfinger.net,
phil@philpotter.co.uk, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: change the allocation type of pdata_attr
Date: Thu, 31 Mar 2022 11:09:03 +0200 [thread overview]
Message-ID: <YkVvr/Pxfud21Mut@kroah.com> (raw)
In-Reply-To: <tencent_884B806033C3E7D6734450A085172A55FF0A@qq.com>
On Thu, Mar 31, 2022 at 03:37:00PM +0800, xkernel.wang@foxmail.com wrote:
> From: Xiaoke Wang <xkernel.wang@foxmail.com>
>
> `pdata_attr` was allocated by kzalloc() in go_add_group_info_attr(), but
> there is a lack of error handlers along the call chain it lies and the
> lifetime of `pdata_attr` is only in go_add_group_info_attr().
> Therefore, changing it to a local variable on stack like the other
> functions in rtw_p2p.c is a possible choice, such as
> `u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 };` in build_probe_resp_p2p_ie()
> which is the caller of go_add_group_info_attr().
>
> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
> ---
> drivers/staging/r8188eu/core/rtw_p2p.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c
> index e2b6cf2..f1a5df8 100644
> --- a/drivers/staging/r8188eu/core/rtw_p2p.c
> +++ b/drivers/staging/r8188eu/core/rtw_p2p.c
> @@ -27,15 +27,14 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf)
> struct list_head *phead, *plist;
> u32 len = 0;
> u16 attr_len = 0;
> - u8 tmplen, *pdata_attr, *pstart, *pcur;
> + u8 pdata_attr[MAX_P2P_IE_LEN] = { 0x00 };
As I said before, this is way too big to put on the stack.
prev parent reply other threads:[~2022-03-31 9:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 7:37 [PATCH] staging: r8188eu: change the allocation type of pdata_attr xkernel.wang
2022-03-31 9:09 ` Greg KH [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=YkVvr/Pxfud21Mut@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Larry.Finger@lwfinger.net \
--cc=dan.carpenter@oracle.com \
--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 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.