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]
Date:   Wed, 11 Sep 2019 12:16:59 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Sandro Volery <sandro@...ery.com>
Cc:     devel@...verdev.osuosl.org, gregkh@...uxfoundation.org,
        davem@...emloft.net, linux-kernel@...r.kernel.org,
        aaro.koskinen@....fi
Subject: Re: [PATCH] Staging: octeon: Avoid several usecases of strcpy

On Wed, Sep 11, 2019 at 11:04:38AM +0200, Sandro Volery wrote:
> 
> 
> > On 11 Sep 2019, at 10:52, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> > 
> > On Wed, Sep 11, 2019 at 08:23:59AM +0200, Sandro Volery wrote:
> >> strcpy was used multiple times in strcpy to write into dev->name.
> >> I replaced them with strscpy.
> >> 
> >> Signed-off-by: Sandro Volery <sandro@...ery.com>
> >> ---
> >> drivers/staging/octeon/ethernet.c | 16 ++++++++--------
> >> 1 file changed, 8 insertions(+), 8 deletions(-)
> >> 
> >> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> >> index 8889494adf1f..cf8e9a23ebf9 100644
> >> --- a/drivers/staging/octeon/ethernet.c
> >> +++ b/drivers/staging/octeon/ethernet.c
> >> @@ -784,7 +784,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
> >>            priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
> >>            priv->port = CVMX_PIP_NUM_INPUT_PORTS;
> >>            priv->queue = -1;
> >> -            strcpy(dev->name, "pow%d");
> >> +            strscpy(dev->name, "pow%d", sizeof(dev->name));
> > 
> > Is there a program which is generating a warning for this code?  We know
> > that "pow%d" is 6 characters and static analysis tools can understand
> > this code fine so we know it's safe.
> 
> Well I was confused too but checkpatch complained about 
> it so I figured I'd clean it up quick

Ah.  It's a new checkpatch warning.  I don't care in that case.  I'm
fine with replacing all of these in that case.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ