Skip to content

Two printf fixes

Rasmus Villemoes linux-nfs lkml netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 2 repliesIn review
  2. v33 patches 10 repliesSuperseded
  3. v23 patches 11 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches4 repliesSuperseded

Changed in v3 from the cover letter

* Add Andy's ack to 1/3.

* Ensure that string_escape_mem doesn't output partial escape sequences after 2/3, while still preparing for it to do exactly that in 3/3.

* Leave the return value of string_escape_mem as int.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/vsprintf.c: Fix potential NULL deref in hex_stringlib/vsprintf.c+12 -40 replies
2/3lib/string_helpers.c: Refactor string_escape_memlib/string_helpers.c+105 -1031 reply
3/3lib/string_helpers.c: Change semantics of string_escape_memfs/proc/array.c include/linux/string_helpers.h lib/string_helpers.c +3 more+44 -731 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAndy Shevchenko
1/3A-b
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] Two printf fixes

Both %pE and %ph are unusable in kasprintf(), since the occurrence of either will trigger an oops during the first vsnprintf call where kasprintf tries to find the correct size to allocate. These oopses could be papered over with somewhat smaller patches than these, but then the return value from vsnprintf would still not reflect the actual size needed. For %pE, this requires a change of semantics of string_escape_mem and hence an annoyingly large diffstat.

v4: Also update fs/proc/array.c, factor overflow test into separate helper, minor stylistic changes.

Changed in v3:

* Add Andy's ack to 1/3.

* Ensure that string_escape_mem doesn't output partial escape sequences after 2/3, while still preparing for it to do exactly that in 3/3.

* Leave the return value of string_escape_mem as int.

v2: Suggestions from Andy Shevchenko:

* Simpler fix of hex_string().

* The string_escape_mem change is split in two, 2/3 updating the internal helpers and 3/3 then changing the external interface.

Rasmus Villemoes (3):
lib/vsprintf.c: Fix potential NULL deref in hex_string lib/string_helpers.c: Refactor string_escape_mem lib/string_helpers.c: Change semantics of string_escape_mem

 fs/proc/array.c                |   4 +-
 include/linux/string_helpers.h |   8 +-
 lib/string_helpers.c           | 193 +++++++++++++++++------------------------
 lib/test-string_helpers.c      |  38 ++++----
 lib/vsprintf.c                 |  24 +++--
 net/sunrpc/cache.c             |   8 +-
 6 files changed, 127 insertions(+), 148 deletions(-)
Signature · 1 line
2.1.3