On 14/11/2023 14:25, Teo Couprie Diaz wrote:
On 14/11/2023 13:21, Kevin Brodsky wrote:
In fact I'm realising that things are even simpler: ustr doesn't need to be incremented (this has no effect, and it's now done in create_elf_tables()), and as a result we can do away with pad_len too:
for (; len < MAX_ARG_STRLEN; len++) { if (get_user(c, ustr + len)) return -EFAULT; if (c != '\0') break; }
I can amend that too if it makes sense.
Oh, yeah you're absolutely right. It makes it very clear what's going on and simplifies it fairly well.
Happy for you to make the change. (Which skews the patch even more towards being "mostly comments" :) )
There's nothing wrong with that, on the contrary, I'm happy with less code and more comments!
I have made the two tweaks I mentioned in the other email as well as this one. This also allowed me to remove or move most of the local variables in put_str_ptr(). c is now local to the loop, and str_ptr is in a new scope as declarations must be first in any scope, which was no longer the case after factoring out the call to strnlen_user(). Both put_str_ptr() and align_p_for_representable_bounds() are now really minimal, which is great.
And thus, this patch is now in next. Thanks for your perseverance!
Kevin