From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90402C433DB for ; Sun, 7 Feb 2021 15:29:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5903160234 for ; Sun, 7 Feb 2021 15:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbhBGP24 (ORCPT ); Sun, 7 Feb 2021 10:28:56 -0500 Received: from smtprelay0143.hostedemail.com ([216.40.44.143]:53288 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230107AbhBGP0R (ORCPT ); Sun, 7 Feb 2021 10:26:17 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 42D0C837F24A; Sun, 7 Feb 2021 15:25:32 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: road21_3c0a044275f7 X-Filterd-Recvd-Size: 2124 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Sun, 7 Feb 2021 15:25:30 +0000 (UTC) Message-ID: <6d5c18f41277d4d926dbe411df070393b4418d6f.camel@perches.com> Subject: Re: [PATCH] staging: octeon: convert all uses of strlcpy to strscpy in ethernet-mdio.c From: Joe Perches To: Greg KH , Phillip Potter Cc: alexander.sverdlin@nokia.com, andrew@lunn.ch, davem@davemloft.net, chris.packham@alliedtelesis.co.nz, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Sun, 07 Feb 2021 07:25:29 -0800 In-Reply-To: References: <20210207144804.88330-1-phil@philpotter.co.uk> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2021-02-07 at 15:55 +0100, Greg KH wrote: > On Sun, Feb 07, 2021 at 02:48:04PM +0000, Phillip Potter wrote: > > Convert three calls to strlcpy inside the cvm_oct_get_drvinfo function > > to strscpy calls. Fixes a style warning. > > Is it really safe to do this type of conversion here? Yes. No locks are taken by either strlcpy or strscpy, and the conversion is only done where the return value is unused. strscpy is: lib/string.c: * Preferred to strlcpy() since the API doesn't require reading memory lib/string.c- * from the src string beyond the specified "count" bytes, and since lib/string.c: * the return value is easier to error-check than strlcpy()'s. lib/string.c- * In addition, the implementation is robust to the string changing out lib/string.c: * from underneath it, unlike the current strlcpy() implementation. > If so, you need > to provide evidence of it in the changelog, otherwise we could just do a > search/replace across the whole kernel and be done with it :) Yes please. There's a cocci script for that in commit 75b1a8f9d62e ("ALSA: Convert strlcpy to strscpy when return value is unused")