linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backing: silence compiler warning using __printf
@ 2018-04-06 20:14 Mathieu Malaterre
  2018-04-09 15:50 ` Jan Kara
  2018-04-09 15:51 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Mathieu Malaterre @ 2018-04-06 20:14 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Mathieu Malaterre, Jan Kara, Andrew Morton, Nikolay Borisov,
	Tejun Heo, Matthew Wilcox, Minchan Kim, linux-kernel

__printf marker was added in commit d2cc4dde9206 ("bdi_register: add
__printf verification, fix arg mismatch") for function `bdi_register`
since it is useful to verify format and arguments. Apply equivalent gcc
attribute to `bdi_register_va`.

Remove warning triggered with W=1:

  mm/backing-dev.c:881:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 include/linux/backing-dev.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 3e4ce54d84ab..0e9c0f71f726 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -28,6 +28,7 @@ void bdi_put(struct backing_dev_info *bdi);
 
 __printf(2, 3)
 int bdi_register(struct backing_dev_info *bdi, const char *fmt, ...);
+__printf(2, 0)
 int bdi_register_va(struct backing_dev_info *bdi, const char *fmt,
 		    va_list args);
 int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] backing: silence compiler warning using __printf
  2018-04-06 20:14 [PATCH] backing: silence compiler warning using __printf Mathieu Malaterre
@ 2018-04-09 15:50 ` Jan Kara
  2018-04-09 15:51 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2018-04-09 15:50 UTC (permalink / raw)
  To: Mathieu Malaterre
  Cc: Jens Axboe, Jan Kara, Andrew Morton, Nikolay Borisov, Tejun Heo,
	Matthew Wilcox, Minchan Kim, linux-kernel

On Fri 06-04-18 22:14:51, Mathieu Malaterre wrote:
> __printf marker was added in commit d2cc4dde9206 ("bdi_register: add
> __printf verification, fix arg mismatch") for function `bdi_register`
> since it is useful to verify format and arguments. Apply equivalent gcc
> attribute to `bdi_register_va`.
> 
> Remove warning triggered with W=1:
> 
>   mm/backing-dev.c:881:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
>  include/linux/backing-dev.h | 1 +
>  1 file changed, 1 insertion(+)

Yeah, the patch looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> 
> diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
> index 3e4ce54d84ab..0e9c0f71f726 100644
> --- a/include/linux/backing-dev.h
> +++ b/include/linux/backing-dev.h
> @@ -28,6 +28,7 @@ void bdi_put(struct backing_dev_info *bdi);
>  
>  __printf(2, 3)
>  int bdi_register(struct backing_dev_info *bdi, const char *fmt, ...);
> +__printf(2, 0)
>  int bdi_register_va(struct backing_dev_info *bdi, const char *fmt,
>  		    va_list args);
>  int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner);
> -- 
> 2.11.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] backing: silence compiler warning using __printf
  2018-04-06 20:14 [PATCH] backing: silence compiler warning using __printf Mathieu Malaterre
  2018-04-09 15:50 ` Jan Kara
@ 2018-04-09 15:51 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2018-04-09 15:51 UTC (permalink / raw)
  To: Mathieu Malaterre
  Cc: Jan Kara, Andrew Morton, Nikolay Borisov, Tejun Heo,
	Matthew Wilcox, Minchan Kim, linux-kernel

On 4/6/18 2:14 PM, Mathieu Malaterre wrote:
> __printf marker was added in commit d2cc4dde9206 ("bdi_register: add
> __printf verification, fix arg mismatch") for function `bdi_register`
> since it is useful to verify format and arguments. Apply equivalent gcc
> attribute to `bdi_register_va`.
> 
> Remove warning triggered with W=1:
> 
>   mm/backing-dev.c:881:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Applied, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-09 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 20:14 [PATCH] backing: silence compiler warning using __printf Mathieu Malaterre
2018-04-09 15:50 ` Jan Kara
2018-04-09 15:51 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).