Re: [PATCH v5 3/6] lib/base64: rework encode/decode for speed and stricter validation

Andrew Morton
2025-11-18T17:24:09Z

On Tue, 18 Nov 2025 11:38:46 +0100 Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> The file also needs to fix the kernel-doc
>
> $ scripts/kernel-doc -none -v -Wall lib/base64.c
> Warning: lib/base64.c:24 This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
> * Initialize the base64 reverse mapping for a single character
> Warning: lib/base64.c:36 This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
> * Recursive macros to generate multiple Base64 reverse mapping table entries.
> Info: lib/base64.c:67 Scanning doc for function base64_encode
> Info: lib/base64.c:119 Scanning doc for function base64_decode

Thanks.

--- a/lib/base64.c~lib-base64-optimize-base64_decode-with-reverse-lookup-tables-fix
+++ a/lib/base64.c
@@ -21,7 +21,7 @@ static const char base64_tables[][65] =
[BASE64_IMAP] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,",
};

-/**
+/*
* Initialize the base64 reverse mapping for a single character
* This macro maps a character to its corresponding base64 value,
* returning -1 if the character is invalid.
@@ -33,7 +33,8 @@ static const char base64_tables[][65] =
: (v) >= 'a' && (v) <= 'z' ? (v) - 'a' + 26 \
: (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
: (v) == (ch_62) ? 62 : (v) == (ch_63) ? 63 : -1
-/**
+
+/*
* Recursive macros to generate multiple Base64 reverse mapping table entries.
* Each macro generates a sequence of entries in the lookup table:
* INIT_2 generates 2 entries, INIT_4 generates 4, INIT_8 generates 8, and so on up to INIT_32.
_