Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4988920rdb; Tue, 12 Dec 2023 15:51:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtxUQTActmjXBgJnwI3RSBcgLKTkcn5PSPi7Uu6b1Y19bXWvQPz3rel/md+APtUQe8BK9Y X-Received: by 2002:a05:6a20:13cc:b0:18f:fcc5:4c64 with SMTP id ho12-20020a056a2013cc00b0018ffcc54c64mr7710678pzc.67.1702425116726; Tue, 12 Dec 2023 15:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702425116; cv=none; d=google.com; s=arc-20160816; b=oPlLyV9YKc9kcYyCcTn53HLXSHWmKHtBggb+FskxqXLEmKtzqTqg6b2pAY/75gw09p NJuuzbFbNQRxttr8nNKVjSGiBYmu4bu4ydok7Nk61y8qiuw3IXuSoafHayUJZ5CogYr6 mLfu+bvpSrJkpwscjeN3B5s0nq6aqLWW887FABhp9pGhY5khPU5tiBySJykjLRu2WsaG meeWJYHkbBxpHs0M6aEtkvkEtX3T0xNcJ2a+ugQDWsx22rLT4eM61YrMoOSFu75p3v8s 29nk3m5pFnyn1A2N3wbeoN9APS4Lo/ZJeyV7RYkeHvMTXXwRabU9eCHc0QXi7RgNoh2H eyOw== 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=iDJv/MdPWACPkzPDU+UdHfxT6bKwGCJYIve5sJRmC4w=; fh=eP2DD6SnrE6EmKMJmnjOzorHUfQqJzTkK9tXgF16m5M=; b=nv9WQfEkkC83stwPSfkdj+HK28eTfBQ3ffx8nkfdRGxt6Q4msSfMBCH2BA3w5RKlcr BvA5BFz+ifK2hqsyTJQxsTyIT6gZdvM4qyaOOPpn4ejFq7wBrxwH/qZKfCkEGjRw8ktL CHuEkMC9iey+zpaP3vUcTy1xf7Wp9CfsC4i96RiCw82npFCR4k6U/PY8HCiPO5M098aL 6EWt3tWxueNTxovAy0Et4vPgcvNWXqK1jC+09n5yYzWRFYqNjDJlv2dQjbagFfgZunR9 dHAS3LYb/wBs9uyEnCS9/WEBdDH+3bXCmDaiX4YBBr/jwsmc9bNSUGmv57SebCJf7PwN 9bzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CacnCAzw; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id s11-20020a65690b000000b005c6bc2367ebsi8344782pgq.216.2023.12.12.15.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 15:51:56 -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=@chromium.org header.s=google header.b=CacnCAzw; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 385A580A191B; Tue, 12 Dec 2023 15:51:38 -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 S1377527AbjLLXvN (ORCPT + 99 others); Tue, 12 Dec 2023 18:51:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377516AbjLLXvK (ORCPT ); Tue, 12 Dec 2023 18:51:10 -0500 Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0323DB2 for ; Tue, 12 Dec 2023 15:51:16 -0800 (PST) Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-49618e09f16so1549967e0c.2 for ; Tue, 12 Dec 2023 15:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1702425075; x=1703029875; 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=iDJv/MdPWACPkzPDU+UdHfxT6bKwGCJYIve5sJRmC4w=; b=CacnCAzwSbudmwwYJOMgYdksuVWzV/PGJjKuKG4M3a615cLK/lglaxwE9zk5hFFLo5 +CqOmBQkgfnp+8zkSWZPaEYV2GPASHFAN0D/DVDYAcvWKYf6BsFnTuqXOIo5xD1gxawY JHRdJIBcuHHuqOuh2uRLB5L1jEmpvSNMxTbVM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702425075; x=1703029875; 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=iDJv/MdPWACPkzPDU+UdHfxT6bKwGCJYIve5sJRmC4w=; b=NhLL8Q2W4wjt+/WRiGp4hWdTGY6UXZGQAtvF/fh6Z4W6kLiohydvLcsmkJVGE/TooI jHcgIA48jxgvynP6uiclPPljx62PtEp4Npc6w0wTP8/YTTrZsWHu0Er2pUEujylpZCEu nYgFwVGltE9E66goNh6wa4EjPbuYjVAp/C5i/FKeQ237h1y8nbOH2yZxebd/32tVPwDp URUrnj59o/hSHprxOKmqzFw3GuKexi3x/vQycZUdqUcWDGX4L3ESxyNDCQDXuY5+l7Gz 2EvGHrAqLVIDVU1VBB6lFTXcYE+4NL/7HSZteKTOL+6HSbJkLyIsMa1kaB5oW61fjPBT x0pg== X-Gm-Message-State: AOJu0Yx8WyUpd/9hGbJHqWirKoymUm/j7efsPAFPO6KqonsO4kuhO1Ee bV98jpO4KonHwMFAGH/ld+WyQSP7wWfZTh0r65+QLw== X-Received: by 2002:a05:6122:31a:b0:4b2:a7a9:b2a with SMTP id c26-20020a056122031a00b004b2a7a90b2amr5285959vko.11.1702425075124; Tue, 12 Dec 2023 15:51:15 -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: Gwendal Grignou Date: Tue, 12 Dec 2023 15:51:04 -0800 Message-ID: Subject: Re: [PATCH v2] iio: sx9324: avoid copying property strings To: Justin Stitt Cc: Stephen Boyd , Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Tue, 12 Dec 2023 15:51:38 -0800 (PST) Reviewed-by: Gwendal Grignou On Mon, Dec 11, 2023 at 4:46=E2=80=AFPM Justin Stitt wrote: > > 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, "semt= ech,ph0-pin"); > > break; > > case SX9324_REG_AFE_PH1: > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semt= ech,ph1-pin"); > > break; > > case SX9324_REG_AFE_PH2: > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semt= ech,ph2-pin"); > > break; > > case SX9324_REG_AFE_PH3: > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "semt= ech,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-s= x9324-c-v3-1-b8ae12fc8a5d@google.com/ > > Thanks > Justin