diff mbox series

drm/komeda: Clean warnings: candidate for 'gnu_printf’ format attribute

Message ID 20191114071839.29120-1-james.qian.wang@arm.com (mailing list archive)
State New, archived
Headers show
Series drm/komeda: Clean warnings: candidate for 'gnu_printf’ format attribute | expand

Commit Message

James Qian Wang Nov. 14, 2019, 7:18 a.m. UTC
komeda/komeda_pipeline.c: In function ‘komeda_component_add’:
komeda/komeda_pipeline.c:213:3: warning: function ‘komeda_component_add’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
   vsnprintf(c->name, sizeof(c->name), name_fmt, args);
   ^~~~~~~~~

komeda/komeda_event.c: In function ‘komeda_sprintf’:
komeda/komeda_event.c:31:2: warning: function ‘komeda_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  num = vsnprintf(str->str + str->len, free_sz, fmt, args);

Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_event.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mihail Atanassov Nov. 14, 2019, 8:47 a.m. UTC | #1
Hi James,

On Thursday, 14 November 2019 07:18:56 GMT james qian wang (Arm Technology China) wrote:
> komeda/komeda_pipeline.c: In function ‘komeda_component_add’:
> komeda/komeda_pipeline.c:213:3: warning: function ‘komeda_component_add’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>    vsnprintf(c->name, sizeof(c->name), name_fmt, args);
>    ^~~~~~~~~

The fix for this one isn't in the patch below.

> 
> komeda/komeda_event.c: In function ‘komeda_sprintf’:
> komeda/komeda_event.c:31:2: warning: function ‘komeda_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>   num = vsnprintf(str->str + str->len, free_sz, fmt, args);
> 
> Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_event.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> index bf269683f811..977c38d516da 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> @@ -17,6 +17,7 @@ struct komeda_str {
>  
>  /* return 0 on success,  < 0 on no space.
>   */
> +__printf(2, 3)
>  static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
>  {
>  	va_list args;
> -- 
> 2.20.1
> 
>
James Qian Wang Nov. 14, 2019, 8:58 a.m. UTC | #2
On Thu, Nov 14, 2019 at 08:47:58AM +0000, Mihail Atanassov wrote:
> Hi James,
> 
> On Thursday, 14 November 2019 07:18:56 GMT james qian wang (Arm Technology China) wrote:
> > komeda/komeda_pipeline.c: In function ‘komeda_component_add’:
> > komeda/komeda_pipeline.c:213:3: warning: function ‘komeda_component_add’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> >    vsnprintf(c->name, sizeof(c->name), name_fmt, args);
> >    ^~~~~~~~~
> 
> The fix for this one isn't in the patch below.

Because the upstream code already have it, But I forgot to update the
comment msg, will send v2 to fix it.

Thanks
James

> > 
> > komeda/komeda_event.c: In function ‘komeda_sprintf’:
> > komeda/komeda_event.c:31:2: warning: function ‘komeda_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> >   num = vsnprintf(str->str + str->len, free_sz, fmt, args);
> > 
> > Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
> > ---
> >  drivers/gpu/drm/arm/display/komeda/komeda_event.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > index bf269683f811..977c38d516da 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
> > @@ -17,6 +17,7 @@ struct komeda_str {
> >  
> >  /* return 0 on success,  < 0 on no space.
> >   */
> > +__printf(2, 3)
> >  static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
> >  {
> >  	va_list args;
> > -- 
> > 2.20.1
> > 
> > 
> 
> 
> -- 
> Mihail
> 
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
index bf269683f811..977c38d516da 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c
@@ -17,6 +17,7 @@  struct komeda_str {
 
 /* return 0 on success,  < 0 on no space.
  */
+__printf(2, 3)
 static int komeda_sprintf(struct komeda_str *str, const char *fmt, ...)
 {
 	va_list args;