From: Kees Cook <keescook@chromium.org>
To: Justin Stitt <justinstitt@google.com>
Cc: Geoff Levand <geoff@infradead.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-hardening@vger.kernel.org,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <nathan@kernel.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/3] powerpc/ps3: refactor strncpy usage attempt 2
Date: Mon, 14 Aug 2023 16:13:55 -0700 [thread overview]
Message-ID: <202308141612.818819C6@keescook> (raw)
In-Reply-To: <20230811-strncpy-arch-powerpc-platforms-ps3-v1-2-301052a5663e@google.com>
On Fri, Aug 11, 2023 at 09:19:20PM +0000, Justin Stitt wrote:
> This approach tries to use `make_field` inside of `make_first_field`.
> This comes with some weird implementation as to get the same result we
> need to first subtract `index` from the `make_field` result whilst being
> careful with order of operations. We then have to add index back.
I think for readability, it's better to avoid the function composition.
The index subtraction undoes the earlier addition -- I say just leave it
separate.
i.e. I like option 1 of 3 the best.
-Kees
--
Kees Cook
WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Justin Stitt <justinstitt@google.com>
Cc: Geoff Levand <geoff@infradead.org>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>,
Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH RFC 2/3] powerpc/ps3: refactor strncpy usage attempt 2
Date: Mon, 14 Aug 2023 16:13:55 -0700 [thread overview]
Message-ID: <202308141612.818819C6@keescook> (raw)
In-Reply-To: <20230811-strncpy-arch-powerpc-platforms-ps3-v1-2-301052a5663e@google.com>
On Fri, Aug 11, 2023 at 09:19:20PM +0000, Justin Stitt wrote:
> This approach tries to use `make_field` inside of `make_first_field`.
> This comes with some weird implementation as to get the same result we
> need to first subtract `index` from the `make_field` result whilst being
> careful with order of operations. We then have to add index back.
I think for readability, it's better to avoid the function composition.
The index subtraction undoes the earlier addition -- I say just leave it
separate.
i.e. I like option 1 of 3 the best.
-Kees
--
Kees Cook
next prev parent reply other threads:[~2023-08-14 23:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 21:19 [PATCH RFC 0/3] powerpc/ps3: refactor strncpy usage Justin Stitt
2023-08-11 21:19 ` Justin Stitt
2023-08-11 21:19 ` [PATCH RFC 1/3] powerpc/ps3: refactor strncpy usage attempt 1 Justin Stitt
2023-08-11 21:19 ` Justin Stitt
2023-08-14 12:28 ` Michael Ellerman
2023-08-14 12:28 ` Michael Ellerman
2023-08-11 21:19 ` [PATCH RFC 2/3] powerpc/ps3: refactor strncpy usage attempt 2 Justin Stitt
2023-08-11 21:19 ` Justin Stitt
2023-08-14 23:13 ` Kees Cook [this message]
2023-08-14 23:13 ` Kees Cook
2023-08-11 21:19 ` [PATCH RFC 3/3] powerpc/ps3: refactor strncpy usage attempt 2.5 Justin Stitt
2023-08-11 21:19 ` Justin Stitt
2023-08-11 21:25 ` [PATCH RFC 0/3] powerpc/ps3: refactor strncpy usage Justin Stitt
2023-08-11 21:25 ` Justin Stitt
2023-08-14 12:31 ` Michael Ellerman
2023-08-14 12:31 ` Michael Ellerman
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=202308141612.818819C6@keescook \
--to=keescook@chromium.org \
--cc=christophe.leroy@csgroup.eu \
--cc=geoff@infradead.org \
--cc=justinstitt@google.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=npiggin@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.