Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4335423rdb; Mon, 11 Dec 2023 16:46:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkgnPwHLMIG4mQ4aY2Hc0wGSWZ6Xu0M6TIRQ6npspRcM8je5KdiQu+9EKe+u7ZDwz9zNeq X-Received: by 2002:a0d:ee44:0:b0:5d7:1940:b38e with SMTP id x65-20020a0dee44000000b005d71940b38emr4421040ywe.90.1702342005150; Mon, 11 Dec 2023 16:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702342005; cv=none; d=google.com; s=arc-20160816; b=Bs96TM9GpDd2+JnHsDRIsD5b8oxU/r1jXcFfCjd8AQ+k6ezkpwYkAvNZugmcFki3Sa B10RokhdAcuD57nn6et6cXFWZjoc2Gc0boKKpsO2xaSAhWTNlkeg5DMfe5rerUU7mIVS JeLZSGk0SJ70lpfBHuJQqtuP9kdKWZRnmd+ZTSY2asxuEXR2aQn5k/5FgMnCtnZ+aYu6 PZwpHqYCFKhcES5FHR+syuKEiNVMWFgN//5Ehggd4Sy5RQ7U9btkRiSBiApOE5LH7FYO YKsnjOAr21whXsxkemiW5vvyw8AvVlWNiVbrtrIglatWUaGC3ghyyXJOvoMUSY3cGDza IHRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zGDztTP9Y8jmLygA/ILQ99z4JlzsbnXKKrjvScgU9V8=; fh=lCfzX0zdVvKnLf6SW2CDTzffNJKt9d8Sz5Y9+XnwyGI=; b=OqCZzLtx9NzhQkdcr3Ciqh31akjZhDI00ORUi+hEuKdqcN4woHh2vLmM5yxC84HHIu njHU89AVsjm6HpZ6cAEy/IBONvt/EkUwaT/J+15zYGd3kNqCPNZ4kJqYLf1pMZj0G7Pi ZqHhrpdqhD7n7+IaBx3gOPYCTYiuVp10oo8nabaqkYJIUyAD+le2ujMr/GzouDeUKSw7 Acbz6Je5G1f8ZCi9FvP4mDbDYsNLhXmSCAkvKafYOK6kNWN/QrYw2RUrUMZv/aaT32/H fj1SKaU6zdH6k4lDpTHj32KhCxUrJhHB1/5dplpx/H8pMrA6GR9dMa45CcBdP104A9Ly lMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pk+ZLWqU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id f10-20020a17090274ca00b001d078e31ca8si6842856plt.293.2023.12.11.16.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 16:46:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pk+ZLWqU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CA04E80C61B4; Mon, 11 Dec 2023 16:46:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345517AbjLLAq2 (ORCPT + 99 others); Mon, 11 Dec 2023 19:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbjLLAq1 (ORCPT ); Mon, 11 Dec 2023 19:46:27 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A23D89F for ; Mon, 11 Dec 2023 16:46:33 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9fa45e75ed9so578618766b.1 for ; Mon, 11 Dec 2023 16:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702341992; x=1702946792; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zGDztTP9Y8jmLygA/ILQ99z4JlzsbnXKKrjvScgU9V8=; b=pk+ZLWqUHYIvu8d9k+G0s0CWKocvLC8DYhIushLNhPUSTu8f8+VH7lteILZTs+irpa Ak6dNTTDPlcBVf6+pFizlMoGDszp4ZtKdxCNcdZHiqj54f+i3xAE7sN7mDC4GIDvHtT3 hCvFceWhvSMDpIs07mILYdbGSkVvmtToYfc/idiLuOF1ZOJqQtLKZAPEj0Cr3Yo9le0W LAstZg+Ed7LuLP7Bu7kUfdZb2Ci/x21m5mGoXPNBMGrGTplnfZ+xCIx5DWGZmOzN78QY ftWrj8fB/LXiODnVuT5LWkeNSDAQKNc42ww0Dnbowp6aFyJNf1Ao8vFhuH+srOzBekLq mSIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702341992; x=1702946792; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zGDztTP9Y8jmLygA/ILQ99z4JlzsbnXKKrjvScgU9V8=; b=XomiAzOMRdT8gviNkCXsJsdFi7+3EGJn3/4r60A0zA04JSkTpd2C20YvMUIY0y1ACn YggdK2BjTFuu+2pzxsxDzhjXstEiK7PXDODYQEpBnr90PH1u+/I415a8OxSwX7te0QhH 2CWS/xcDzjiMm60kfSBy3xubdBKf7x/uPnbGzC3WQPL+KON5Y7sZP34mrBoqZ3BeQK/D 57GJo8OFsMib7JrrV/cmIA5W+DkvXt3QDOMR9fD0BKsAWGZgUb6qm0tmfmEXoxnJ1VuM lOl0A55PKiWHrrsndzer8GNlSg8X461ut8P1pYxeXACbo9eFsP66PJJPV0GZ2XzTyj70 hmGg== X-Gm-Message-State: AOJu0YwXSF7bkar/On6MKkMNRupaJ/ttg1UtQC2xSybAu4nKebQw4myt 7y53ujtL9byItRCLNuSNVIhUiL/F4Hv8/X1uqJKmEA== X-Received: by 2002:a17:907:72cb:b0:a19:a19a:ead2 with SMTP id du11-20020a17090772cb00b00a19a19aead2mr3218422ejc.139.1702341992095; Mon, 11 Dec 2023 16:46:32 -0800 (PST) MIME-Version: 1.0 References: <20231026-strncpy-drivers-iio-proximity-sx9324-c-v2-1-cee6e5db700c@google.com> <20231028162638.5b477ded@jic23-huawei> In-Reply-To: From: Justin Stitt Date: Mon, 11 Dec 2023 16:46:20 -0800 Message-ID: Subject: Re: [PATCH v2] iio: sx9324: avoid copying property strings To: Stephen Boyd Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Gwendal Grignou Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 11 Dec 2023 16:46:43 -0800 (PST) Hi, On Mon, Oct 30, 2023 at 2:44=E2=80=AFPM Stephen Boyd = wrote: > > > We need to free it in other places too, like if the count doesn't match. > It may be easier to extract this section and just have 4 string > literals. > > switch (reg_def->reg) { > case SX9324_REG_AFE_PH0: > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semtec= h,ph0-pin"); > break; > case SX9324_REG_AFE_PH1: > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semtec= h,ph1-pin"); > break; > case SX9324_REG_AFE_PH2: > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semtec= h,ph2-pin"); > break; > case SX9324_REG_AFE_PH3: > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semtec= h,ph3-pin"); > break; > I've submitted v3 of this patch [1] trying out Stephen's idea. I'd appreciate feedback. [1]: https://lore.kernel.org/all/20231212-strncpy-drivers-iio-proximity-sx9= 324-c-v3-1-b8ae12fc8a5d@google.com/ Thanks Justin