[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFhGd8rBd7_7apXF9XTtBHkUG4FSmfa4YLkiQVow_pA05-9mSw@mail.gmail.com>
Date: Tue, 19 Mar 2024 14:00:05 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Maarten Brock <Maarten.Brock@...ls.nl>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Jiri Slaby <jirislaby@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH] tty: n_gsm: replace deprecated strncpy with strscpy
Hi,
On Tue, Mar 19, 2024 at 2:11 AM Maarten Brock <Maarten.Brock@...ls.nl> wrote:
>
> Hi Justin,
>
> > ---
> > Note: build-tested only.
>
> Really? Without warnings?
>
> > --- a/drivers/tty/n_gsm.c
> > +++ b/drivers/tty/n_gsm.c
> > @@ -4010,7 +4010,7 @@ static int gsm_create_network(struct gsm_dlci *dlci,
> > struct gsm_netconfig *nc)
> > mux_net = netdev_priv(net);
> > mux_net->dlci = dlci;
> > kref_init(&mux_net->ref);
> > - strncpy(nc->if_name, net->name, IFNAMSIZ); /* return net name */
> > + strscpy(nc->if_name, net->name); /* return net name */
>
> Where did IFNAMSIZ go?
There's a new 2-argument strscpy introduced in Commit e6584c3964f2f
("string: Allow 2-argument strscpy()"). Since the compiler can find
nc->if_name's size (which is == IFNAMSIZ) it should be A-OK to swap to
this new form.
>
> Kind regards,
> Maarten Brock
>
Thanks
Justin
Powered by blists - more mailing lists