From: Jeff Mahoney Subject: kmsg: Fix parameter limitations Patch-mainline: Whenever kmsg is upstream The kmsg infrastructure, currently only employed on s/390, has limitations with the parameters it can handle due to the way it assembles the magic string for parsing with scripts/kmsg-doc. cpp expects the result to be a valid expression and exits with an error if it is not. The netfilter ipvs code causes this error, though there are more examples: error: pasting "_ARGS_" and "&" does not give a valid preprocessing token This stems from an otherwise valid expression: pr_info("Registered protocols (%s)\n", &protocols[2]); It tries to concatenate _ARGS_ and &protocols[2] and fails. This patch fixes the issue by stringifying the entire parameter list and allowing kmsg-doc to unquote the resultant expression. The dev_* expressions that evaluate to __KMSG_DEV are unaffected because the insertion of the "dev, " between _ARGS_ and the parameter list ends up creating a valid expression. Signed-off-by: Jeff Mahoney --- include/linux/printk.h | 2 +- scripts/kmsg-doc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -416,7 +416,7 @@ extern int hex_to_bin(char ch); /* generate magic string for scripts/kmsg-doc to parse */ #define pr_printk_hash(level, format, ...) \ - __KMSG_PRINT(level _FMT_ format _ARGS_ ##__VA_ARGS__ _END_) + __KMSG_PRINT(level _FMT_ format _ARGS_ #__VA_ARGS__ _END_) #elif defined(CONFIG_KMSG_IDS) && defined(KMSG_COMPONENT) --- a/scripts/kmsg-doc +++ b/scripts/kmsg-doc @@ -307,7 +307,7 @@ sub process_cpp_file($$$$) while () { chomp; - if (/.*__KMSG_PRINT\(\s*(\S*)\s*_FMT_(.*)_ARGS_\s*(.*)?_END_\s*\)/o) { + if (/.*__KMSG_PRINT\(\s*(\S*)\s*_FMT_(.*)_ARGS_\s*"(.*)"\s*_END_\s*\)/o) { if ($component ne "") { add_kmsg_print($component, $1, $2, $3); } else {