Kernel implementation of vsscanf() has some limitations.

Signed-off-by: Konstantin Khlebnikov <khlebni...@yandex-team.ru>
---
 lib/vsprintf.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 791b6fa36905..276a0bc3b019 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3004,6 +3004,28 @@ EXPORT_SYMBOL_GPL(bprintf);
  * @buf:       input buffer
  * @fmt:       format of buffer
  * @args:      arguments
+ *
+ * Returns number of successfully matched arguments.
+ *
+ * This function implements only basic vsscanf features:
+ *
+ * - conversion specifiers: d, i, o, u, x, X, s, c, [, n
+ * - type modifiers: hh, h, l, L, ll, z
+ *
+ * Not implemented features:
+ *
+ * - floating-point numbers
+ * - memory-allocation "%m..."
+ * - pointer "%p", ptrdiff_t "%t...", intmax_t "%j..."
+ * - discaring of matching input "%*[...]"
+ * - ranges or matching ']' in "%[...]"
+ * - positional assignment "%n$"
+ *
+ * Non-standatd features:
+ *
+ * - "%[...]" requires field width
+ * - %s without field width limited with SHRT_MAX
+ * - "%*..." simply skips non white-space characters without conversion
  */
 int vsscanf(const char *buf, const char *fmt, va_list args)
 {
@@ -3291,6 +3313,12 @@ EXPORT_SYMBOL(vsscanf);
  * @buf:       input buffer
  * @fmt:       formatting of buffer
  * @...:       resulting arguments
+ *
+ * Returns number of successfully matched arguments.
+ *
+ * See format description in comment for vsscanf() above.
+ *
+ * For single integer conversion it is better to use kstrto*().
  */
 int sscanf(const char *buf, const char *fmt, ...)
 {

Reply via email to