Re: [PATCH] tty: n_gsm: replace deprecated strncpy with strscpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Mar 19, 2024 at 2:11 AM Maarten Brock <Maarten.Brock@xxxxxxxx> 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





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux