diff mbox series

[ovs-dev] netdev-linux: fix compile error in nl_msg_put_act_police

Message ID 20210713113352.1082-1-simon.horman@netronome.com
State Accepted
Headers show
Series [ovs-dev] netdev-linux: fix compile error in nl_msg_put_act_police | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot success github build: passed

Commit Message

Simon Horman July 13, 2021, 11:33 a.m. UTC
From: Yong Xu <yong.xu@corigine.com>

Use 'memset' to init memory to 0.

This resolves a build problem with clang on Ubuntu 16.04 on ARM (in Travis):

libtool: compile:  clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
-Wunused-parameter -Wbad-function-cast -Wcast-align
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-Wmissing-field-initializers -Wthread-safety -fno-strict-aliasing
-Wswitch-bool -Wlogical-not-parentheses -Wsizeof-array-argument
-Wshift-negative-value -Qunused-arguments -Wshadow
-Warray-bounds-pointer-arithmetic -Werror -Werror -g -O2
-Wno-error=unused-command-line-argument -DHAVE_AVX512F -MT
lib/netlink-conntrack.lo -MD -MP -MF lib/.deps/netlink-conntrack.Tpo
-c lib/netlink-conntrack.c -o lib/netlink-conntrack.o
lib/netdev-linux.c:2638:38: error: missing field 'action' initializer
[-Werror,-Wmissing-field-initializers]
    struct tc_police null_police = {0};
                                     ^
1 error generated.
make[2]: *** [lib/netdev-linux.lo] Error 1
make[2]: *** Waiting for unfinished jobs....

Fixes: c2567e533 ("add port-based ingress policing based packet-per-second rate-limiting")
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Yong Xu <yong.xu@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
 lib/netdev-linux.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

0-day Robot July 13, 2021, 11:39 a.m. UTC | #1
Bleep bloop.  Greetings Simon Horman, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@netronome.com>
Lines checked: 55, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
David Marchand July 13, 2021, 11:58 a.m. UTC | #2
On Tue, Jul 13, 2021 at 1:34 PM Simon Horman <simon.horman@netronome.com> wrote:
>
> From: Yong Xu <yong.xu@corigine.com>
>
> Use 'memset' to init memory to 0.
>
> This resolves a build problem with clang on Ubuntu 16.04 on ARM (in Travis):
>
> libtool: compile:  clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
> -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
> -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
> -Wunused-parameter -Wbad-function-cast -Wcast-align
> -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
> -Wmissing-field-initializers -Wthread-safety -fno-strict-aliasing
> -Wswitch-bool -Wlogical-not-parentheses -Wsizeof-array-argument
> -Wshift-negative-value -Qunused-arguments -Wshadow
> -Warray-bounds-pointer-arithmetic -Werror -Werror -g -O2
> -Wno-error=unused-command-line-argument -DHAVE_AVX512F -MT
> lib/netlink-conntrack.lo -MD -MP -MF lib/.deps/netlink-conntrack.Tpo
> -c lib/netlink-conntrack.c -o lib/netlink-conntrack.o
> lib/netdev-linux.c:2638:38: error: missing field 'action' initializer
> [-Werror,-Wmissing-field-initializers]
>     struct tc_police null_police = {0};
>                                      ^
> 1 error generated.
> make[2]: *** [lib/netdev-linux.lo] Error 1
> make[2]: *** Waiting for unfinished jobs....
>
> Fixes: c2567e533 ("add port-based ingress policing based packet-per-second rate-limiting")
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Yong Xu <yong.xu@corigine.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>

I used some of the few Travis credits I still have to check this patch.
It fixes the build issue I saw previously.

Patch lgtm, thanks.
Simon Horman July 13, 2021, 5:09 p.m. UTC | #3
On Tue, Jul 13, 2021 at 01:58:54PM +0200, David Marchand wrote:
> On Tue, Jul 13, 2021 at 1:34 PM Simon Horman <simon.horman@netronome.com> wrote:
> >
> > From: Yong Xu <yong.xu@corigine.com>
> >
> > Use 'memset' to init memory to 0.
> >
> > This resolves a build problem with clang on Ubuntu 16.04 on ARM (in Travis):
> >
> > libtool: compile:  clang -DHAVE_CONFIG_H -I. -I ./include -I ./include
> > -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
> > -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
> > -Wunused-parameter -Wbad-function-cast -Wcast-align
> > -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
> > -Wmissing-field-initializers -Wthread-safety -fno-strict-aliasing
> > -Wswitch-bool -Wlogical-not-parentheses -Wsizeof-array-argument
> > -Wshift-negative-value -Qunused-arguments -Wshadow
> > -Warray-bounds-pointer-arithmetic -Werror -Werror -g -O2
> > -Wno-error=unused-command-line-argument -DHAVE_AVX512F -MT
> > lib/netlink-conntrack.lo -MD -MP -MF lib/.deps/netlink-conntrack.Tpo
> > -c lib/netlink-conntrack.c -o lib/netlink-conntrack.o
> > lib/netdev-linux.c:2638:38: error: missing field 'action' initializer
> > [-Werror,-Wmissing-field-initializers]
> >     struct tc_police null_police = {0};
> >                                      ^
> > 1 error generated.
> > make[2]: *** [lib/netdev-linux.lo] Error 1
> > make[2]: *** Waiting for unfinished jobs....
> >
> > Fixes: c2567e533 ("add port-based ingress policing based packet-per-second rate-limiting")
> > Reported-by: David Marchand <david.marchand@redhat.com>
> > Signed-off-by: Yong Xu <yong.xu@corigine.com>
> > Signed-off-by: Simon Horman <simon.horman@netronome.com>
> 
> I used some of the few Travis credits I still have to check this patch.
> It fixes the build issue I saw previously.
> 
> Patch lgtm, thanks.

Thanks David,

applied.
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index d5e693464..60dd13891 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2635,7 +2635,9 @@  nl_msg_put_act_police(struct ofpbuf *request, struct tc_police police,
     size_t offset, act_offset;
     uint32_t prio = 0;
     /* used for PPS, set rate as 0 to act as a single action */
-    struct tc_police null_police = {0};
+    struct tc_police null_police;
+
+    memset(&null_police, 0, sizeof null_police);
 
     if (police.rate.rate) {
         nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset);