Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1546504
| From | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() |
| Date | 2016-12-22 18:20 +0100 |
| Message-ID | <sRfc6-3Sa-19@gated-at.bofh.it> (permalink) |
| References | <sR8DE-8bR-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2016-12-22 at 11:09 +0100, Nicolas Iooss wrote:
> Structure ishtp_device contains a logging function, print_log(),
> which
> formats some of its parameters using vsnprintf(). Add a __printf
> attribute to this function field (and to ish_event_tracer()) in order
> to
> detect at compile time issues related to the printf-like formatting.
>
> While at it, make format parameter a const pointer as print_log() is
> not
> supposed to modify it.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/hid/intel-ish-hid/ipc/pci-ish.c | 3 ++-
> drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> index 20d647d2dd2c..34c95de6885e 100644
> --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> @@ -47,7 +47,8 @@ MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
> *
> * Callback to direct log messages to Linux trace buffers
> */
> -static void ish_event_tracer(struct ishtp_device *dev, char *format,
> ...)
> +static __printf(2, 3)
> +void ish_event_tracer(struct ishtp_device *dev, const char *format,
> ...)
> {
> if (trace_ishtp_dump_enabled()) {
> va_list args;
> diff --git a/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
> b/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
> index a94f9a8a96a0..6a6d927b78b0 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
> +++ b/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
> @@ -238,7 +238,8 @@ struct ishtp_device {
> uint64_t ishtp_host_dma_rx_buf_phys;
>
> /* Dump to trace buffers if enabled*/
> - void (*print_log)(struct ishtp_device *dev, char *format,
> ...);
> + __printf(2, 3) void (*print_log)(struct ishtp_device *dev,
> + const char *format, ...);
>
> /* Debug stats */
> unsigned int ipc_rx_cnt;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-12-22 11:20 +0100 Re: [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-12-22 18:20 +0100 Re: [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() Jiri Kosina <jikos@kernel.org> - 2017-01-02 13:20 +0100
csiph-web