diff mbox series

[nfs-utils,5/7] rpcgen: rpc_cout: fix potential -Wformat-nonliteral warning

Message ID 20200103215039.27471-6-giulio.benetti@benettiengineering.com (mailing list archive)
State Accepted
Headers show
Series silence some warning in rpcgen | expand

Commit Message

Giulio Benetti Jan. 3, 2020, 9:50 p.m. UTC
format and vecformat must be declared as "char * const" to be really
treated as constant when building with -Werror=format-nonliteral,
otherwise compiler will consider them subject to change throughout the
function.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 tools/rpcgen/rpc_cout.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Giulio Benetti Jan. 15, 2020, 4:29 p.m. UTC | #1
Hi Steve,

you've missed this patch while applying the series. Can you please 
commit it?

Thank you
Kind regards
Steve Dickson Jan. 16, 2020, 8:07 p.m. UTC | #2
On 1/15/20 11:29 AM, Giulio Benetti wrote:
> Hi Steve,
> 
> you've missed this patch while applying the series. Can you please commit it?
It is in...

commit 6f4568f1f7395f967cc03995dcfb79a1ac5c11cd
Author: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date:   Mon Jan 6 14:23:04 2020 -0500

    rpcgen: rpc_hout: fix potential -Wformat-security warning
    
    f_print()'s argument "separator" is not known because it's passed as an
    argument and with -Wformat-security will cause a useless warning. Let's
    ignore by adding "#pragma GCC diagnostic ignored/warning" before and
    after f_print().
    
    Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
    Signed-off-by: Steve Dickson <steved@redhat.com>

what am I missing?

steved.
Giulio Benetti Jan. 16, 2020, 8:38 p.m. UTC | #3
On 1/16/20 9:07 PM, Steve Dickson wrote:
> 
> 
> On 1/15/20 11:29 AM, Giulio Benetti wrote:
>> Hi Steve,
>>
>> you've missed this patch while applying the series. Can you please commit it?
> It is in...
> 
> commit 6f4568f1f7395f967cc03995dcfb79a1ac5c11cd
> Author: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Date:   Mon Jan 6 14:23:04 2020 -0500
> 
>      rpcgen: rpc_hout: fix potential -Wformat-security warning
>      
>      f_print()'s argument "separator" is not known because it's passed as an
>      argument and with -Wformat-security will cause a useless warning. Let's
>      ignore by adding "#pragma GCC diagnostic ignored/warning" before and
>      after f_print().
>      
>      Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>      Signed-off-by: Steve Dickson <steved@redhat.com>
> 
> what am I missing?

Ah you've merged them together, now I see:
[5/7] https://patchwork.kernel.org/patch/11317493/
[6/7] https://patchwork.kernel.org/patch/11317489/

I didn't notice it while pull rebasing from upstream, because I have 
another patch similar to that after bumping to latest version of rpcgen.

Sorry for the noise and thank you!
Best regards
diff mbox series

Patch

diff --git a/tools/rpcgen/rpc_cout.c b/tools/rpcgen/rpc_cout.c
index f806a86a..df2609c4 100644
--- a/tools/rpcgen/rpc_cout.c
+++ b/tools/rpcgen/rpc_cout.c
@@ -319,8 +319,8 @@  emit_union(definition *def)
   case_list *cl;
   declaration *cs;
   char *object;
-  char *vecformat = "objp->%s_u.%s";
-  char *format = "&objp->%s_u.%s";
+  char * const vecformat = "objp->%s_u.%s";
+  char * const format = "&objp->%s_u.%s";
 
   print_stat(1,&def->def.un.enum_decl);
   f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);