lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210723151510.GB2612@titan>
Date:   Fri, 23 Jul 2021 17:15:10 +0200
From:   Len Baker <len.baker@....com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        David Laight <David.Laight@...LAB.COM>
Cc:     Len Baker <len.baker@....com>,
        Larry Finger <Larry.Finger@...inger.net>,
        Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Pavel Skripkin <paskripkin@...il.com>,
        "linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging/rtl8712: Remove all strcpy() uses in favor of
 strscpy()

Hi,

On Wed, Jul 21, 2021 at 11:06:24AM +0300, Dan Carpenter wrote:
> On Mon, Jul 19, 2021 at 03:24:38PM +0000, David Laight wrote:
> > From: Dan Carpenter
> > > Sent: 19 July 2021 06:38
> > ...
> > > Not related to your patch but this code is bad.  What it does is the
> > > "ifname" can be set as a module parameter.  So instead of testing if it
> > > has been set, it uses the checking inside dev_alloc_name() to see if we
> > > can allocate what the user requested.  If not then set it to "wlan%d".
> > > If we cannot allocate what the user wants then we should return an
> > > error.
> > >
> > > It should do:
> > >
> > > 	if (ifname[0] == '\0')
> > > 		strscpy(ifname, "wlan%d", sizeof(ifname));
> > >
> > > 	ret = dev_alloc_name(pnetdev, ifname);
> > > 	if (ret < 0) {
> > > 		dev_err(pnetdev, "allocating device name failed.\n");
> > > 		return NULL;
> > > 	}
> >
> > I know only root can set module parameters, but having one
> > that contains a string used as a printf format seems
> > dangerous at best.
> >
> > Isn't it best to let userspace rename the interfaces later on?
>
> Yeah.  I think you're right.

Sorry, but I don't understand if the code needs to be improved or not.
Is the code shown by Dan not correct?

>
> regards,
> dan carpenter
>

Thanks for your time,
Len

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ