Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7907008rwp; Wed, 19 Jul 2023 02:04:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEqNOCIBw3EaQUKvgPe2ypFbLLfSvfKAFCijE97ukSH9tanOo2Z8GnQoV3bE56Hjhxue48t X-Received: by 2002:a05:6a20:3d8e:b0:134:5c75:3d23 with SMTP id s14-20020a056a203d8e00b001345c753d23mr12891114pzi.18.1689757493431; Wed, 19 Jul 2023 02:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689757493; cv=none; d=google.com; s=arc-20160816; b=KmQ96Ibyq5dBkrn83q7Bq49ZqqmSc1BlPwLzdzoLanL5oyudT5FQoETCLNoG6RpJQE tqaWl+jBHnYDcxTHkKLkUKilrfZ8t2t8ys5MkKPVUJ3hgRUVyVLnTiwjCaqBAoFSILSU bsKkf0NyltVMxy1RU6Tra5Ii1OKmMzJF688GphgLxVhfN66iq8QFDb20iySaljKIHq9w P4aUN4SbBK656SbhAp9gfdxVT9uSr+oEMNDQ4F/fSE/dMRNDk3hCThbi6UJ/ARyXtIuE UGAWi/+y1L+1qo1zVNmeX1ZDcf4l8Q6Mt2e07lFgvyvaUr5pwujaPt4A5H3zjHaDcRAZ WXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=fbHMe19/L40yR9NOGI+YxUBZZdZfsftuUEHzUxAnexE=; fh=b6Z8YtNR/Vo/JXLNi43OA6yFRfXozaxN6sBfLMPDAZA=; b=m3LHBJYY/aQgYDTVfexcMocHUplD2v3bnfYZ5+NrLi4sSVaGkfxyF6edzDjJiQFZv+ l9todNhOXds4wLDEe43UzDTibfM8551mn+g7npJVxRYbB4QfCCqmncXKYlRDWi8+IraO bH6Q0+bVPmTyloXuNmkS+56NPlkFoKvuPdfSfCUY7LZNiIj3oI0gJAcuQK2VJ6/U5+sM VmLzH3N/jo3+cYX0PxGckpzbbc/wd+sHwakm4X/U61OYdJQ8NjkCsOI1IcTIK5VQU6ib NxHiVTNZjX2VxSzq0IPzQLWkOKYW/dm0c//w8MAuBc39cHN5JFuTXb9bkaKYy65AWGsY im3A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bw25-20020a056a00409900b0067a39a4c12bsi3033100pfb.81.2023.07.19.02.04.38; Wed, 19 Jul 2023 02:04:53 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbjGSIsN convert rfc822-to-8bit (ORCPT + 99 others); Wed, 19 Jul 2023 04:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbjGSIsG (ORCPT ); Wed, 19 Jul 2023 04:48:06 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B08510E for ; Wed, 19 Jul 2023 01:48:02 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-231-2FrdlNlEO-aRlwCr8sDXcg-1; Wed, 19 Jul 2023 09:47:59 +0100 X-MC-Unique: 2FrdlNlEO-aRlwCr8sDXcg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 19 Jul 2023 09:47:57 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 19 Jul 2023 09:47:57 +0100 From: David Laight To: 'Andrew Lunn' , 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 Thread-Topic: [PATCH] net: dsa: remove deprecated strncpy Thread-Index: AQHZua5uBGaLyFdvXEuDn4GOsjwmUK/Ax0MA Date: Wed, 19 Jul 2023 08:47:57 +0000 Message-ID: <02afcfd1dc4d4c258c2c5ffbda2688c8@AcuMS.aculab.com> References: <20230718-net-dsa-strncpy-v1-1-e84664747713@google.com> <316E4325-6845-4EFC-AAF8-160622C42144@kernel.org> <20230718121116.72267fff@kernel.org> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Andrew Lunn > Sent: 18 July 2023 20:31 ... > 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. Define the structure with the length from the start. Add a wrapper that allows the length to be absent. (Either ignoring the length or using 0/infinity to mean no length.) Then you don't need to visit everywhere twice - just some places. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)