On Sat, 2017-05-20 at 13:16 +0200, Nicolas Iooss wrote:
> nsp32_message() and nsp32_dmessage() use printf format strings in order
> to format a message. Adding __printf attributes helps to detect errors
> in such format strings at build time, like:
> 
>     drivers/scsi/nsp32.c:3314:23: error: format '%ld' expects argument
>     of type 'long int', but argument 6 has type 'pm_message_t {aka
>     struct pm_message}' [-Werror=format=]
>       nsp32_msg(KERN_INFO,
>       "pci-suspend: pdev=0x%p, state=%ld, slot=%s, host=0x%p",
>       pdev, state, pci_name(pdev), host);
> 
> Fix all format string errors which were reported by gcc.
[]
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
[]
> @@ -321,7 +323,8 @@ static struct scsi_host_template nsp32_template = {
>  
>  #define NSP32_DEBUG_BUF_LEN          100
>  
> -static void nsp32_message(const char *func, int line, char *type, char *fmt, 
> ...)
> +static __printf(4, 5)
> +void nsp32_message(const char *func, int line, char *type, const char *fmt, 
> ...)
>  {
>       va_list args;
>       char buf[NSP32_DEBUG_BUF_LEN];

These could also use vsprintf extension %pV instead of
vsnprintf to a
temporary buffer and then using "%s, <tmp>"

etc...

Does anyone actually have or use these cards any longer?

Reply via email to