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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17FA3CDB474 for ; Sat, 14 Oct 2023 16:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233230AbjJNQd4 (ORCPT ); Sat, 14 Oct 2023 12:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232238AbjJNQdz (ORCPT ); Sat, 14 Oct 2023 12:33:55 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7054B7; Sat, 14 Oct 2023 09:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ckHPv1sodqbF6lifWLlHzkUp3Ph1Z+9dz/OCscR9s84=; b=S73aBPifwKqmrm/X8vJwwk++Ov Woj8DwtPzhu0RSM+iDCxB0QZPa8RfOknlQS8l9D3K6mrBqbe30hYm2SMlez3GssVpY5WTg90vOeTB RTeceVgGl6ZuT9vOXzm/PMg+wyjrkZYSw0UPlLguWbFBDCjff5UzIyWwXfuPzBpMySa0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qrhaG-002Bfl-Hs; Sat, 14 Oct 2023 18:33:48 +0200 Date: Sat, 14 Oct 2023 18:33:48 +0200 From: Andrew Lunn To: Justin Stitt Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net: usb: replace deprecated strncpy with strscpy Message-ID: References: <20231012-strncpy-drivers-net-usb-sr9800-c-v1-1-5540832c8ec2@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012-strncpy-drivers-net-usb-sr9800-c-v1-1-5540832c8ec2@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 12, 2023 at 10:33:34PM +0000, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > Other implementations of .*get_drvinfo use strscpy so this patch brings > sr_get_drvinfo() in line as well: > > igb/igb_ethtool.c +851 > static void igb_get_drvinfo(struct net_device *netdev, > > igbvf/ethtool.c > 167:static void igbvf_get_drvinfo(struct net_device *netdev, > > i40e/i40e_ethtool.c > 1999:static void i40e_get_drvinfo(struct net_device *netdev, > > e1000/e1000_ethtool.c > 529:static void e1000_get_drvinfo(struct net_device *netdev, > > ixgbevf/ethtool.c > 211:static void ixgbevf_get_drvinfo(struct net_device *netdev, > > ... > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt Reviewed-by: Andrew Lunn Andrew