From mboxrd@z Thu Jan 1 00:00:00 1970 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) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U6+N/5b5" 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-iio@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