On Tue, Jun 02, 2026 at 10:32:04PM +0200, Arnd Bergmann wrote: > On Tue, Jun 2, 2026, at 20:59, Andy Shevchenko wrote: > > On Tue, Jun 02, 2026 at 05:07:05PM +0200, Arnd Bergmann wrote:
... > > Why the __printf() annotation is in the C file and not here? > > Is this all about headers as the second paragraph in the commit message > > explains? > > I would add a comment to explain it here, otherwise we might see false > > patches to "make things consistent" in a wrong way. > > I've tried to come up with a kerneldoc comment now, similar to > the one for the vsnprintf() function, and added a separate prototype > in the header. Does this address your concern? Yes, see one nit, though. > -int __printf(3, 0) __vsnprintf(char *buf, size_t size, const char *fmt_str, > va_list args) > +/** > + * __vsnprintf - vsnprintf() wrapper without __printf() attribute > + * @buf: The buffer to place the result into > + * @size: The size of the buffer, including the trailing null space > + * @fmt_str: The format string to use > + * @args: Arguments for the format string > + * > + * This has the exact same behavior as vsnprintf() but can be used in call > + * sites that are missing a __printf() annotation, e.g. because they > + * get a 'va_format' argument instead of format and varargs. > + * > + * For this to work, the attribute is added to the declaration here but > + * not in the header. + * + * Return: ... > + */ > +int __printf(3, 0) __vsnprintf(char *buf, size_t size, const char *fmt_str, > va_list args); > + > +int __vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args) Something slipped here... -- With Best Regards, Andy Shevchenko
