On Wed, 2018-04-25 at 13:12 +0200, Petr Mladek wrote: > There are few printk formats that make sense only with two or more > specifiers. Also some specifiers make sense only when a kernel feature > is enabled. > > The handling of unknown specifiers is strange, inconsistent, and > even leaking the address. For example, netdev_bits() prints the > non-hashed pointer value or clock() prints "(null)". > > Using WARN() looks like an overkill for this type of error. pr_warn() > is not good either. It would by handled via printk_sage buffer and > it might be hard to match it with the problematic string. > > A reasonable compromise seems to be writing the unknown format > specifier > into the original string with a question mark, for example (%pC?). > It should be self-explaining enough. Note that it is in brackets > to follow the (null) style.
> + return valid_string(buf, end, "(%pG?)", spec); > > if (!IS_ENABLED(CONFIG_OF)) > - return valid_string(buf, end, "(!OF)", spec); > + return valid_string(buf, end, "(%OF?)", spec); "(%pOF?)" ? -- Andy Shevchenko <[email protected]> Intel Finland Oy

