From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Malavya Raval" <malavyaraval@gmail.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
<linux-staging@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
"Luka Gejak" <luka.gejak@linux.dev>
Subject: Re: [PATCH] staging: rtl8723bs: Break long lines in rtw_sta_mgt.c
Date: Thu, 19 Mar 2026 09:39:57 +0100 [thread overview]
Message-ID: <DH6MGYQKECQS.3R3HVA14O8AQ6@linux.dev> (raw)
In-Reply-To: <20260319024807.7755-1-malavyaraval@gmail.com>
Hi Malavya,
Thanks for the patch!
I have a concern regarding the first hunk of this change:
> - pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4);
> + pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(*pstapriv->pallocated_stainfo_buf) *
> + NUM_STA + 4);
You've changed the logic from taking the size of 'struct sta_info' to
the size of the dereferenced pointer
'*pstapriv->pallocated_stainfo_buf'.
Firstly: In this driver, 'pallocated_stainfo_buf' is a u8 pointer. This
means sizeof(*ptr) will return 1, whereas 'struct sta_info' is much
larger. This will lead to a significantly smaller memory allocation
than intended and cause a buffer overflow.
If you want to use the preferred 'sizeof(*ptr)' style, you should use
the pointer that actually represents the structure array, or stick to
the original 'struct sta_info' and just wrap the line.
Secondly: For a v2, when splitting the line, 'NUM_STA' should be
vertically aligned with the start of the 'sizeof' expression on the
line above. Right now, the indentation looks a bit off.
Also, for a v2, please ensure your subject line starts with a lowercase
letter after the prefix: "staging: rtl8723bs: break long lines..."
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-03-19 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 2:48 [PATCH] staging: rtl8723bs: Break long lines in rtw_sta_mgt.c Malavya Raval
2026-03-19 8:39 ` Luka Gejak [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-03-19 17:42 [PATCH] staging: rtl8723bs: break " MalavyaRaval
2026-03-19 18:58 ` Ethan Tidmore
2026-03-19 18:59 ` Ethan Tidmore
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=DH6MGYQKECQS.3R3HVA14O8AQ6@linux.dev \
--to=luka.gejak@linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=malavyaraval@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox