diff mbox

[ovs-dev] ofproto-dpif-xlate: Fix VLOG_ERR_RL() call.

Message ID 20160812005408.5393-1-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Aug. 12, 2016, 12:54 a.m. UTC
a716ef9a7a73 ("ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR.")
inadvertantly broke build on clang due to improper passing of the ds
cstring into the VLOG() function:

error: format string is not a string literal
      (potentially insecure) [-Werror,-Wformat-security]
        XLATE_REPORT_ERROR(ctx, "over max translation depth %d", MAX_DEPTH);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: expanded from macro
      'XLATE_REPORT_ERROR'
            VLOG_ERR_RL(&error_report_rl, ds_cstr(&ds));        \

Reported-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 ofproto/ofproto-dpif-xlate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniele Di Proietto Aug. 12, 2016, 12:58 a.m. UTC | #1
2016-08-11 17:54 GMT-07:00 Joe Stringer <joe@ovn.org>:

> a716ef9a7a73 ("ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR.")
> inadvertantly broke build on clang due to improper passing of the ds
> cstring into the VLOG() function:
>
> error: format string is not a string literal
>       (potentially insecure) [-Werror,-Wformat-security]
>         XLATE_REPORT_ERROR(ctx, "over max translation depth %d",
> MAX_DEPTH);
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~
> note: expanded from macro
>       'XLATE_REPORT_ERROR'
>             VLOG_ERR_RL(&error_report_rl, ds_cstr(&ds));        \
>
> Reported-by: Daniele Di Proietto <diproiettod@vmware.com>
> Signed-off-by: Joe Stringer <joe@ovn.org>
>

Thanks for fixing it. It works for me now

Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Joe Stringer Aug. 12, 2016, 1:03 a.m. UTC | #2
On 11 August 2016 at 17:58, Daniele Di Proietto <diproiettod@ovn.org> wrote:
>
>
> 2016-08-11 17:54 GMT-07:00 Joe Stringer <joe@ovn.org>:
>>
>> a716ef9a7a73 ("ofproto-dpif-xlate: Log flow in XLATE_REPORT_ERROR.")
>> inadvertantly broke build on clang due to improper passing of the ds
>> cstring into the VLOG() function:
>>
>> error: format string is not a string literal
>>       (potentially insecure) [-Werror,-Wformat-security]
>>         XLATE_REPORT_ERROR(ctx, "over max translation depth %d",
>> MAX_DEPTH);
>>
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> note: expanded from macro
>>       'XLATE_REPORT_ERROR'
>>             VLOG_ERR_RL(&error_report_rl, ds_cstr(&ds));        \
>>
>> Reported-by: Daniele Di Proietto <diproiettod@vmware.com>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
>
> Thanks for fixing it. It works for me now
>
> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>

Thanks for the report, it seems my standard push prechecks skip the
clang compile so this fell through.

Applied to master.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 1e375b58f195..f0a25011fc42 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -637,7 +637,7 @@  static struct vlog_rate_limit error_report_rl = VLOG_RATE_LIMIT_INIT(1, 5);
             ds_put_format(&ds, __VA_ARGS__);                    \
             ds_put_cstr(&ds, ": ");                             \
             flow_format(&ds, &ctx->base_flow);                  \
-            VLOG_ERR_RL(&error_report_rl, ds_cstr(&ds));        \
+            VLOG_ERR_RL(&error_report_rl, "%s", ds_cstr(&ds));  \
             ds_destroy(&ds);                                    \
         }                                                       \
     } while (0)