Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp116638rdb; Sun, 17 Dec 2023 05:00:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoM6KX9z48dDPHdBdZTdy3Ha1aAMHwQJFDkdTfg69AxA07drvbBxdE3D5EBbxSKmYFoB3c X-Received: by 2002:a05:6358:ce17:b0:170:67b3:6d80 with SMTP id gt23-20020a056358ce1700b0017067b36d80mr13638111rwb.42.1702818056725; Sun, 17 Dec 2023 05:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702818056; cv=none; d=google.com; s=arc-20160816; b=xes2FKsWDxoNrNqk5G/HDZgLNL87RoXinMkKgNPQze3ufjOr10s0su085n5mrw2aLJ LQZrY7wTp8xu2VlQK0vw5gtdsjIOZMdF/qk5Jb4KeTSV6dEw+GW8Ti8OcsiIKoALDG6C +PUIM50UtdioL955b1mxWYOTr/gWLTa9VoJI5/Xn/ADosCSZk+uktP25jrCnnl/4pz1p CAYVh0q/y1z4UwPXPccD9wpSTeFOOli8f1mX5euVTfHtSY9y4Re0XEz/C28GRBwAZQXC GwnuMc7x2JAg+hg4eRlddq7HfDFvM8OUJK1y8xdG9EaHRUt1BQouF2pcZ2M5+2m0crgp LSwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=T8bY/4DhzTRRZ5NLw7QSjozvxoL55YHd3OVWQYKff/c=; fh=ECBtr57dzB3H2++EGmlNtD0aMzLdpfT0F7v5Is3XbvI=; b=Vc+M+zliCqPFhAiuhDFwpOttoUlTJvaZ+FraNLXy3zjl9hMKv/7R9tYXyZ43bywl2c C/ASjFuiiKKthTGCwPY1OxKqWC1wVNFL9onGUtppgwtda8rWMrEdl84nftZlg7MmpN5R bdtsxYMAvSdGdnn9ilWcmJPRc2dzXaZNzDHJYydvzgcUPBXEtMyWN5ROZd83Q2ims33z 1nCvplbBI2cFAB5dbFOvIFOlRwf7kiDcX3Dq5Gz/Nt+Ac4AeJhQSG6f30tCswtknfrhK zbV4Tgz5XOb5PxIliFRykJXY/UVWS3TkVR7zsjwLrI18JjJYljj6rmnb1yjkOurvscKa /wmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U6+N/5b5"; spf=pass (google.com: domain of linux-kernel+bounces-2585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2585-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z2-20020a63e102000000b005c6eb3502bfsi16201654pgh.309.2023.12.17.05.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 05:00:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U6+N/5b5"; spf=pass (google.com: domain of linux-kernel+bounces-2585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2585-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E9FE2282E48 for ; Sun, 17 Dec 2023 13:00:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57F9843AB0; Sun, 17 Dec 2023 13:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U6+N/5b5" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 805623308A; Sun, 17 Dec 2023 13:00:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFD61C433C7; Sun, 17 Dec 2023 13:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702818047; bh=ceURb/yin7nwojjm8+LwtekPtcFpkviBi0xv8iONU88=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U6+N/5b5iLgxIysBZAhqwbeBjRXfaIQjnbntFC88Cpc+wZ4nkU7YgVvFhKswURIHs hu7JOfmDiXGR+lLtm2U2Q4MbffLOH+4WFRLOIhqJDsUz5ZJPKSyWjXl370oRzpP/e8 75gyoCqrqhHXjbgucBM5+5wfPoTCl+14axw6juMKHJGuJ4arvggF5qTQagSTUzfLTO 6/iDzvbqaj+bzbwcPBs9Mf/5Kv/h9U0zmR1SihUohrXSq+pGY0zMS/HZy0kHUN/fy+ Nv9c45/kp5Ql8JV+Jlvqlo78jlW//WbfGqQ3+ORCQhK/no2kxIvRVaqj62Alge0XuY GSipfc3xAu6Nw== Date: Sun, 17 Dec 2023 13:00:33 +0000 From: Jonathan Cameron To: Gwendal Grignou Cc: Justin Stitt , Stephen Boyd , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] iio: sx9324: avoid copying property strings Message-ID: <20231217130033.0b3a5ac6@jic23-huawei> In-Reply-To: References: <20231026-strncpy-drivers-iio-proximity-sx9324-c-v2-1-cee6e5db700c@google.com> <20231028162638.5b477ded@jic23-huawei> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 12 Dec 2023 15:51:04 -0800 Gwendal Grignou wrote: > Reviewed-by: Gwendal Grignou Hi Gwendal I'll ignore this tag given the email you've replied to says there is a diff= erent implementation. Please take a look at that version instead. Jonathan >=20 > 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: =20 > > > > > > > > > We need to free it in other places too, like if the count doesn't mat= ch. > > > 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, "se= mtech,ph0-pin"); > > > break; > > > case SX9324_REG_AFE_PH1: > > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "se= mtech,ph1-pin"); > > > break; > > > case SX9324_REG_AFE_PH2: > > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "se= mtech,ph2-pin"); > > > break; > > > case SX9324_REG_AFE_PH3: > > > reg_def =3D sx9324_parse_phase_prop(dev, reg_def, "se= mtech,ph3-pin"); > > > break; > > > =20 > > > > 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= -sx9324-c-v3-1-b8ae12fc8a5d@google.com/ > > > > Thanks > > Justin =20