[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240204151854.581fb780@jic23-huawei>
Date: Sun, 4 Feb 2024 15:18:54 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Justin Stitt <justinstitt@...gle.com>, Lars-Peter Clausen
<lars@...afoo.de>, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v5] iio: sx9324: avoid copying property strings
On Fri, 2 Feb 2024 15:38:03 -0600
Stephen Boyd <swboyd@...omium.org> wrote:
> Quoting Justin Stitt (2024-02-01 10:55:03)
> > We're doing some needless string copies when trying to assign the proper
> > `prop` string. We can make `prop` a const char* and simply assign to
> > string literals.
> >
> > For the case where a format string is used, let's extract the parsing
> > logic out into sx9324_parse_phase_prop(). We no longer need to create
> > copies or allocate new memory.
> >
> > sx9324_parse_phase_prop() will simply return the default def value if it
> > fails.
> >
> > This also cleans up some deprecated strncpy() uses [1].
> >
> > Furthermore, let's clean up this code further by removing some unused
> > defines:
> > | #define SX9324_PIN_DEF "semtech,ph0-pin"
> > | #define SX9324_RESOLUTION_DEF "semtech,ph01-resolution"
> > | #define SX9324_PROXRAW_DEF "semtech,ph01-proxraw-strength"
> >
> > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> > Link: https://github.com/KSPP/linux/issues/90
> > Cc: linux-hardening@...r.kernel.org
> > Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> > ---
>
> Reviewed-by: Stephen Boyd <swboyd@...omium.org>
Applied
Powered by blists - more mailing lists