From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Nicolas Iooss <nicolas.iooss_linux@m4x.org>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log()
Date: Thu, 22 Dec 2016 09:11:17 -0800 [thread overview]
Message-ID: <1482426677.6264.17.camel@linux.intel.com> (raw)
In-Reply-To: <20161222100910.6179-1-nicolas.iooss_linux@m4x.org>
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;
next prev parent reply other threads:[~2016-12-22 17:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 10:09 [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() Nicolas Iooss
2016-12-22 10:09 ` [PATCH 2/2] HID: intel-ish-hid: format 32-bit integers with %X Nicolas Iooss
2016-12-22 17:12 ` Srinivas Pandruvada
2016-12-22 17:11 ` Srinivas Pandruvada [this message]
2017-01-02 12:17 ` [PATCH 1/2] HID: intel-ish-hid: add printf attribute to print_log() Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482426677.6264.17.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.iooss_linux@m4x.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox