Re: [PATCH RFC 2/3] powerpc/ps3: refactor strncpy usage attempt 2

From: Kees Cook
Date: Mon Aug 14 2023 - 19:14:40 EST


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