Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Justin Stitt <justinstitt@google.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v5] iio: sx9324: avoid copying property strings
Date: Sun, 4 Feb 2024 15:18:54 +0000	[thread overview]
Message-ID: <20240204151854.581fb780@jic23-huawei> (raw)
In-Reply-To: <CAE-0n5031k-5Gv+jFuWJekgPfHDw8yjUobqZr6+=UzgOEqOO4w@mail.gmail.com>

On Fri, 2 Feb 2024 15:38:03 -0600
Stephen Boyd <swboyd@chromium.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@vger.kernel.org
> > Signed-off-by: Justin Stitt <justinstitt@google.com>
> > ---  
> 
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>

Applied

      reply	other threads:[~2024-02-04 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 18:55 [PATCH v5] iio: sx9324: avoid copying property strings Justin Stitt
2024-02-02 21:38 ` Stephen Boyd
2024-02-04 15:18   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240204151854.581fb780@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=justinstitt@google.com \
    --cc=lars@metafoo.de \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox