From: Abhishek Tamboli <abhishektamboli9@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: gregkh@linuxfoundation.org, tdavies@darkphysics.net,
philipp.g.hortmann@gmail.com, garyrookard@fastmail.org,
linux-staging@lists.linux.dev, skhan@linuxfoundation.org,
rbmarliere@gmail.com, christophe.jaillet@wanadoo.fr,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: rtl8192e: Replace strcpy with strcat in rtl819x_translate_scan
Date: Sat, 24 Aug 2024 22:39:49 +0530 [thread overview]
Message-ID: <ZsoT3eQq6muDPh5Z@embed-PC.myguest.virtualbox.org> (raw)
In-Reply-To: <1c640c3d-c5db-4eb7-8a22-6d9886a1412a@stanley.mountain>
On Sat, Aug 24, 2024 at 02:21:47PM +0300, Dan Carpenter wrote:
> On Fri, Aug 23, 2024 at 09:04:11PM +0530, Abhishek Tamboli wrote:
> > diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> > index fbd4ec824084..ec0c4c5bade7 100644
> > --- a/drivers/staging/rtl8192e/rtllib_wx.c
> > +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> > @@ -23,14 +23,14 @@ static const char * const rtllib_modes[] = {
> > };
> >
> > #define MAX_CUSTOM_LEN 64
> > +#define MAX_PROTO_NAME_LEN 10
> > static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
> > char *start, char *stop,
> > struct rtllib_network *network,
> > struct iw_request_info *info)
> > {
> > char custom[MAX_CUSTOM_LEN];
> > - char proto_name[6];
> > - char *pname = proto_name;
> > + char proto_name[MAX_PROTO_NAME_LEN];
>
> In the end I think we don't want to make this buffer larger. But if we did
> this define is really vague and slightly confusing. I assumed it was something
> else when I read it. It hurts readability. It would probably be better to just
> leave it as 6 instead and add a comment. /* Large enough to hold "N-24G" */
Okay, I'll revert the buffer size to 6.
>
> > char *p;
> > struct iw_event iwe;
> > int i, j;
> > @@ -59,13 +59,12 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
> > }
> > /* Add the protocol name */
> > iwe.cmd = SIOCGIWNAME;
> > + /* Initialise proto_name as an empty string*/
>
> This comment doesn't add any information. Every kernel developer knows what
> memset() does.
Sure, I'll remove it.
> > + memset(proto_name, '\0', sizeof(proto_name));
>
> Normally we would just say 0 instead of '\0'. The other way to do this would
> be to initialize it at the start:
>
> char proto_name[6] = "";
>
Thanks, for the feedback. I'll do the changes.
Regards,
Abhishek
prev parent reply other threads:[~2024-08-24 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 15:34 [PATCH v2] staging: rtl8192e: Replace strcpy with strcat in rtl819x_translate_scan Abhishek Tamboli
2024-08-24 5:45 ` Greg KH
2024-08-24 16:59 ` Abhishek Tamboli
2024-08-24 11:21 ` Dan Carpenter
2024-08-24 17:09 ` Abhishek Tamboli [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=ZsoT3eQq6muDPh5Z@embed-PC.myguest.virtualbox.org \
--to=abhishektamboli9@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dan.carpenter@linaro.org \
--cc=garyrookard@fastmail.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=philipp.g.hortmann@gmail.com \
--cc=rbmarliere@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=tdavies@darkphysics.net \
/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.