lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 20 May 2017 04:35:36 -0700 From: Joe Perches <joe@...ches.com> To: Nicolas Iooss <nicolas.iooss_linux@....org>, GOTO Masanori <gotom@...ian.or.jp>, YOKOTA Hiroshi <yokota@...lab.is.tsukuba.ac.jp> Cc: "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>, "Martin K. Petersen" <martin.petersen@...cle.com>, linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH 1/2] scsi: nsp32: add __printf attribute to logging functions 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?
Powered by blists - more mailing lists