Hi Kees, As I anticipated in private, here's an API that we're using in the shadow project. I've added it in the kernel, and started replacing some existing calls to s*printf() calls, and it was a bug mine.
I haven't even built the code yet. I present it for discussion only at the moment. (Thus, RFC, not PATCH.) Also, I've used ==NULL style for null checks, to be more explicit, even if that's against the coding style. I'll change that for the actual patches, but for now during discussion, I prefer having the explicit tests for my own readability. The improvement seems quite obvious. Please let me know your opinion. I also have a few questions for the maintainers of the specific code, or at least for someone who deeply understands it, as I found some questionable code. (See the individual commit messages, and code comments for those.) On top of that, I have a question about the functions I'm adding, and the existing kernel snprintf(3): The standard snprintf(3) can fail (return -1), but the kernel one doesn't seem to return <0 ever. Should I assume that snprintf(3) doesn't fail here? (I have a comment in the source code of the implementation asking for that.) What do you think? Alejandro Colomar (3): vsprintf: Add [v]seprintf(), [v]stprintf() stacktrace, stackdepot: Add seprintf()-like variants of functions mm: Use seprintf() instead of less ergonomic APIs include/linux/stackdepot.h | 13 +++++ include/linux/stacktrace.h | 3 + kernel/stacktrace.c | 28 ++++++++++ lib/stackdepot.c | 12 ++++ lib/vsprintf.c | 109 +++++++++++++++++++++++++++++++++++++ mm/kfence/kfence_test.c | 24 ++++---- mm/kmsan/kmsan_test.c | 4 +- mm/mempolicy.c | 18 +++--- mm/page_owner.c | 32 ++++++----- mm/slub.c | 5 +- 10 files changed, 208 insertions(+), 40 deletions(-) Range-diff against v0: -: ------------ > 1: 2d20eaf1752e vsprintf: Add [v]seprintf(), [v]stprintf() -: ------------ > 2: ec2e375c2d1e stacktrace, stackdepot: Add seprintf()-like variants of functions -: ------------ > 3: be193e1856aa mm: Use seprintf() instead of less ergonomic APIs -- 2.50.0
