From: Eric Engestrom <eric.engestrom@imgtec.com>
To: Joe Perches <joe@perches.com>
Cc: Rob Clark <robdclark@gmail.com>,
Daniel Vetter <daniel.vetter@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Sean Paul <seanpaul@chromium.org>,
David Airlie <airlied@linux.ie>, <linux-kernel@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: drm_printer: add __printf validation
Date: Mon, 20 Feb 2017 12:17:50 +0000 [thread overview]
Message-ID: <20170220121750.k5zakwhwta2xrufo@imgtec.com> (raw)
In-Reply-To: <133858f214e9b90f92bb8eb44c6b1dc04429933d.1487201526.git.joe@perches.com>
On Wednesday, 2017-02-15 15:33:18 -0800, Joe Perches wrote:
> drm_printf does not currently use the compiler to verify
> format and arguments. Make it do so.
>
> Miscellanea:
>
> o Add appropriate #include files for __printf and struct va_format
> o Convert dev_printk to dev_info
I think these unrelated changes should be in 4 patches:
1 - add annotation to check the format string against the arguments
(linux/compiler.h should be added here)
2 - add missing linux/printk.h header for struct va_format
Note that I think a forward declaration is more appropriate here, as
we only use pointers to this struct in this file, we never try to
look inside. On the other hand:
3 - drm_print.c needs the header in drm_printf(), but as a separate
patch
4 - convert dev_printk to dev_info (you need to include linux/device.h
there)
You can add my r-b on all four patches when you send them to the list :)
Cheers,
Eric
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/gpu/drm/drm_print.c | 2 +-
> include/drm/drm_print.h | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 02a107d50706..74c466aca622 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -36,7 +36,7 @@ EXPORT_SYMBOL(__drm_printfn_seq_file);
>
> void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
> {
> - dev_printk(KERN_INFO, p->arg, "[" DRM_NAME "] %pV", vaf);
> + dev_info(p->arg, "[" DRM_NAME "] %pV", vaf);
> }
> EXPORT_SYMBOL(__drm_printfn_info);
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 7d98763c0444..ca4d7c6321f2 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -26,6 +26,8 @@
> #ifndef DRM_PRINT_H_
> #define DRM_PRINT_H_
>
> +#include <linux/compiler.h>
> +#include <linux/printk.h>
> #include <linux/seq_file.h>
> #include <linux/device.h>
>
> @@ -75,6 +77,7 @@ void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
> void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
> void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
>
> +__printf(2, 3)
> void drm_printf(struct drm_printer *p, const char *f, ...);
>
>
> --
> 2.10.0.rc2.1.g053435c
>
next prev parent reply other threads:[~2017-02-20 12:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 23:33 Joe Perches
2017-02-20 12:17 ` Eric Engestrom [this message]
2017-02-20 17:10 ` Joe Perches
2017-02-21 8:26 ` Jani Nikula
2017-02-21 8:32 ` Joe Perches
2017-02-21 9:02 ` Jani Nikula
2017-02-21 9:18 ` Joe Perches
2017-02-26 20:43 ` Daniel Vetter
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=20170220121750.k5zakwhwta2xrufo@imgtec.com \
--to=eric.engestrom@imgtec.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=seanpaul@chromium.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
all inboxes | Powered by JetHome®