Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7277757rwp; Tue, 18 Jul 2023 12:45:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlExXXf6wiwfZRk8RECFAE7f7zkusvnMRFVlOdw76DfuQ1sZWYAQgvHEhrqH+XDzPZJP2RiH X-Received: by 2002:a17:906:190:b0:993:d6e8:2389 with SMTP id 16-20020a170906019000b00993d6e82389mr863387ejb.26.1689709541199; Tue, 18 Jul 2023 12:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689709541; cv=none; d=google.com; s=arc-20160816; b=iBgYM+naqJIX621qN2+iE6A3l6lHlgW7ARA3bT6h+M0PfSM8+RBsbb7SfaLh90a8hJ EZSH6RGDjWvWrjkZQeJG0lY2zXNZ2SEIpwDJex5M4jjvExM6oD3Rm5nEn55VIE9Bmvri TBYLRAXleB3rTFdwqMWA5bq/1TSh6zRl22JHaS8u4F6Odu8AwE7S6O+wbgAgoZKTGNAx V00Tu9vWVBNHlhl/ExjKLuutlzyZKOPncFyW/IH2+3sUVg1LtIWqcrpnIIb7QWgmwFjU Cb+WcYJFhCudeFmaS4KmW6hNUYFxGsw90R7Z+4+QUpR30YOVfs/3MMCpGIj8eKNKk4hj RZOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4lvrkWb6sfRiU5F2WxbxoLsvFXn2cJ/Sdsc7oIw9b8Y=; fh=9Grqgtdm2ImnGyL0t39w7YM4yud08+kv4Q2LAo+ArBY=; b=T2FT0viZbB+lm8bQAsdSdXKm5Ek7jHbYyzxURhae4OxfD6cLx2eE+twxk53cnP9XOx hbvTViXBEiwbaLLdWHPI3d7uoOMHGHOZ6mBUEAjuN4shxFRla5bB/9rPCsgUugpIHCor xUFSZDNfdGrqnJPGulqDilsk1OUL/T/dTTDTGy14/CyXuVDfC2+5cY+MezanFb+nCrJL Bubp1xj5+MsbGUNvk+GHv1rIv1o7Ekg4IBXru6CVNWv+4+i+5AasOQELyEUQaljtpRzW MEDw3jAKiJOGKi30feSBUxsjqVT573gwlMklv2MJ4t5PTBdrbt5uzVsIZWV/Tp7e+qGu hMuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=RxWb4Zqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gy13-20020a170906f24d00b0099396527229si1618067ejb.65.2023.07.18.12.45.15; Tue, 18 Jul 2023 12:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=RxWb4Zqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjGRTbQ (ORCPT + 99 others); Tue, 18 Jul 2023 15:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbjGRTbO (ORCPT ); Tue, 18 Jul 2023 15:31:14 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ED76198D; Tue, 18 Jul 2023 12:31:13 -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=4lvrkWb6sfRiU5F2WxbxoLsvFXn2cJ/Sdsc7oIw9b8Y=; b=RxWb4ZqkCJJM4ETLid0VMKIMWf R8wRhiq0A658gKpuMIItkj4B0yqM6ftio+QEER5QhbdX4T4yEVvPTZfgakdg/4+x0nSkmdfr1FRbC ZENuNMykair96x6nZj53SgSp7oYcWGM5LODf9ZgAyXEDefwaH5Ao0Gp4r1nBQ8QqM8KM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qLqPY-001ePh-BG; Tue, 18 Jul 2023 21:31:04 +0200 Date: Tue, 18 Jul 2023 21:31:04 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Kees Cook , justinstitt@google.com, Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Nick Desaulniers Subject: Re: [PATCH] net: dsa: remove deprecated strncpy Message-ID: References: <20230718-net-dsa-strncpy-v1-1-e84664747713@google.com> <316E4325-6845-4EFC-AAF8-160622C42144@kernel.org> <20230718121116.72267fff@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230718121116.72267fff@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 12:11:16PM -0700, Jakub Kicinski wrote: > On Tue, 18 Jul 2023 11:05:23 -0700 Kees Cook wrote: > > Honestly I find the entire get_strings API to be very fragile given > > the lack of passing the length of the buffer, instead depending on > > the string set length lookups in each callback, but refactoring that > > looks like a ton of work for an uncertain benefit. > > We have been adding better APIs for long term, and a print helper short > term - ethtool_sprintf(). Should we use ethtool_sprintf() here? I was wondering about that as well. There is no variable expansion in most cases, so the vsnprintf() is a waste of time. Maybe we should actually add another helper: ethtool_name_cpy(u8 **data, unsigned int index, const char *name); Then over the next decade, slowly convert all drivers to it. And then eventually replace the u8 with a struct including the length. The netlink API is a bit better. It is one kAPI call which does everything, and it holds RTNL. So it is less likely the number of statistics will change between the calls into the driver. Andrew