diff mbox series

[ovs-dev] datapath: Fix compiling error for latest Linux 4.14 kernel

Message ID 1556302063-23767-1-git-send-email-pkusunyifeng@gmail.com
State Superseded
Headers show
Series [ovs-dev] datapath: Fix compiling error for latest Linux 4.14 kernel | expand

Commit Message

Yifeng Sun April 26, 2019, 6:07 p.m. UTC
CC: Greg Rose <gvrose8192@gmail.com>
Fixes: f72469405eec9 ("datapath: meter: Use struct_size() in kzalloc()")
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 acinclude.m4                                   | 2 ++
 datapath/linux/compat/include/linux/overflow.h | 2 +-
 datapath/meter.c                               | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

Comments

Gregory Rose April 26, 2019, 8:13 p.m. UTC | #1
On 4/26/2019 11:07 AM, Yifeng Sun wrote:
> CC: Greg Rose <gvrose8192@gmail.com>
> Fixes: f72469405eec9 ("datapath: meter: Use struct_size() in kzalloc()")
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> ---
>   acinclude.m4                                   | 2 ++
>   datapath/linux/compat/include/linux/overflow.h | 2 +-
>   datapath/meter.c                               | 1 +
>   3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 1607d5f4b1d9..548cbe9ef100 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -920,6 +920,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>                           [OVS_DEFINE([HAVE_INET_FRAGS_RND])])
>     OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H],
>                     [OVS_DEFINE([HAVE_OVERFLOW_H])])
> +  OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size],
> +                  [OVS_DEFINE([HAVE_STRUCT_SIZE])])
>     OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array],
>                     [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])])
>     OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node],
> diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
> index ff84356db16c..8f1b5b005491 100644
> --- a/datapath/linux/compat/include/linux/overflow.h
> +++ b/datapath/linux/compat/include/linux/overflow.h
> @@ -1,5 +1,5 @@
>   /* SPDX-License-Identifier: GPL-2.0 OR MIT */
> -#ifdef HAVE_OVERFLOW_H
> +#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
>   #include_next <linux/overflow.h>
>   #else
>   #ifndef __LINUX_OVERFLOW_H
> diff --git a/datapath/meter.c b/datapath/meter.c
> index 51ec1495033a..eda14682fb96 100644
> --- a/datapath/meter.c
> +++ b/datapath/meter.c
> @@ -13,6 +13,7 @@
>   #include <linux/ip.h>
>   #include <linux/kernel.h>
>   #include <linux/openvswitch.h>
> +#include <linux/overflow.h>
>   #include <linux/netlink.h>
>   #include <linux/rculist.h>
>   

Thanks for the patch Yifeng, it looks good but I'm curious because when 
I posted the original patch for this it was passing travis build 
checks.  Or I thought so at the time.  It bugs me if I missed something.

In any case I'll give it a quick check and regression test.

- Greg
Yifeng Sun April 26, 2019, 8:18 p.m. UTC | #2
Hi Greg,

I saw the compilation error for kernel 4.14.111 because `struct_size`
isn't defined in kernel source tree. I didn't dig into it though.

Thanks,
Yifeng

On Fri, Apr 26, 2019 at 1:13 PM Gregory Rose <gvrose8192@gmail.com> wrote:
>
>
> On 4/26/2019 11:07 AM, Yifeng Sun wrote:
> > CC: Greg Rose <gvrose8192@gmail.com>
> > Fixes: f72469405eec9 ("datapath: meter: Use struct_size() in kzalloc()")
> > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> > ---
> >   acinclude.m4                                   | 2 ++
> >   datapath/linux/compat/include/linux/overflow.h | 2 +-
> >   datapath/meter.c                               | 1 +
> >   3 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/acinclude.m4 b/acinclude.m4
> > index 1607d5f4b1d9..548cbe9ef100 100644
> > --- a/acinclude.m4
> > +++ b/acinclude.m4
> > @@ -920,6 +920,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
> >                           [OVS_DEFINE([HAVE_INET_FRAGS_RND])])
> >     OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H],
> >                     [OVS_DEFINE([HAVE_OVERFLOW_H])])
> > +  OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size],
> > +                  [OVS_DEFINE([HAVE_STRUCT_SIZE])])
> >     OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array],
> >                     [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])])
> >     OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node],
> > diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
> > index ff84356db16c..8f1b5b005491 100644
> > --- a/datapath/linux/compat/include/linux/overflow.h
> > +++ b/datapath/linux/compat/include/linux/overflow.h
> > @@ -1,5 +1,5 @@
> >   /* SPDX-License-Identifier: GPL-2.0 OR MIT */
> > -#ifdef HAVE_OVERFLOW_H
> > +#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
> >   #include_next <linux/overflow.h>
> >   #else
> >   #ifndef __LINUX_OVERFLOW_H
> > diff --git a/datapath/meter.c b/datapath/meter.c
> > index 51ec1495033a..eda14682fb96 100644
> > --- a/datapath/meter.c
> > +++ b/datapath/meter.c
> > @@ -13,6 +13,7 @@
> >   #include <linux/ip.h>
> >   #include <linux/kernel.h>
> >   #include <linux/openvswitch.h>
> > +#include <linux/overflow.h>
> >   #include <linux/netlink.h>
> >   #include <linux/rculist.h>
> >
>
> Thanks for the patch Yifeng, it looks good but I'm curious because when
> I posted the original patch for this it was passing travis build
> checks.  Or I thought so at the time.  It bugs me if I missed something.
>
> In any case I'll give it a quick check and regression test.
>
> - Greg
Gregory Rose April 26, 2019, 8:31 p.m. UTC | #3
On 4/26/2019 1:18 PM, Yifeng Sun wrote:
> Hi Greg,
>
> I saw the compilation error for kernel 4.14.111 because `struct_size`
> isn't defined in kernel source tree. I didn't dig into it though.

I see the problem then.  The .travis.yml file tests 4.14.63.  Please 
update the patch to include an update
for travis to set the 4.14 kernel being tested to 4.14.111.  That way 
we'll get travis to verify the build as
well.

Thanks!

- Greg


>
> Thanks,
> Yifeng
>
> On Fri, Apr 26, 2019 at 1:13 PM Gregory Rose <gvrose8192@gmail.com> wrote:
>>
>> On 4/26/2019 11:07 AM, Yifeng Sun wrote:
>>> CC: Greg Rose <gvrose8192@gmail.com>
>>> Fixes: f72469405eec9 ("datapath: meter: Use struct_size() in kzalloc()")
>>> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
>>> ---
>>>    acinclude.m4                                   | 2 ++
>>>    datapath/linux/compat/include/linux/overflow.h | 2 +-
>>>    datapath/meter.c                               | 1 +
>>>    3 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/acinclude.m4 b/acinclude.m4
>>> index 1607d5f4b1d9..548cbe9ef100 100644
>>> --- a/acinclude.m4
>>> +++ b/acinclude.m4
>>> @@ -920,6 +920,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>>>                            [OVS_DEFINE([HAVE_INET_FRAGS_RND])])
>>>      OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H],
>>>                      [OVS_DEFINE([HAVE_OVERFLOW_H])])
>>> +  OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size],
>>> +                  [OVS_DEFINE([HAVE_STRUCT_SIZE])])
>>>      OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array],
>>>                      [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])])
>>>      OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node],
>>> diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
>>> index ff84356db16c..8f1b5b005491 100644
>>> --- a/datapath/linux/compat/include/linux/overflow.h
>>> +++ b/datapath/linux/compat/include/linux/overflow.h
>>> @@ -1,5 +1,5 @@
>>>    /* SPDX-License-Identifier: GPL-2.0 OR MIT */
>>> -#ifdef HAVE_OVERFLOW_H
>>> +#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
>>>    #include_next <linux/overflow.h>
>>>    #else
>>>    #ifndef __LINUX_OVERFLOW_H
>>> diff --git a/datapath/meter.c b/datapath/meter.c
>>> index 51ec1495033a..eda14682fb96 100644
>>> --- a/datapath/meter.c
>>> +++ b/datapath/meter.c
>>> @@ -13,6 +13,7 @@
>>>    #include <linux/ip.h>
>>>    #include <linux/kernel.h>
>>>    #include <linux/openvswitch.h>
>>> +#include <linux/overflow.h>
>>>    #include <linux/netlink.h>
>>>    #include <linux/rculist.h>
>>>
>> Thanks for the patch Yifeng, it looks good but I'm curious because when
>> I posted the original patch for this it was passing travis build
>> checks.  Or I thought so at the time.  It bugs me if I missed something.
>>
>> In any case I'll give it a quick check and regression test.
>>
>> - Greg
Yifeng Sun April 26, 2019, 8:32 p.m. UTC | #4
Sure, I will do that.
Thanks!
Yifeng

On Fri, Apr 26, 2019 at 1:31 PM Gregory Rose <gvrose8192@gmail.com> wrote:
>
>
>
> On 4/26/2019 1:18 PM, Yifeng Sun wrote:
> > Hi Greg,
> >
> > I saw the compilation error for kernel 4.14.111 because `struct_size`
> > isn't defined in kernel source tree. I didn't dig into it though.
>
> I see the problem then.  The .travis.yml file tests 4.14.63.  Please
> update the patch to include an update
> for travis to set the 4.14 kernel being tested to 4.14.111.  That way
> we'll get travis to verify the build as
> well.
>
> Thanks!
>
> - Greg
>
>
> >
> > Thanks,
> > Yifeng
> >
> > On Fri, Apr 26, 2019 at 1:13 PM Gregory Rose <gvrose8192@gmail.com> wrote:
> >>
> >> On 4/26/2019 11:07 AM, Yifeng Sun wrote:
> >>> CC: Greg Rose <gvrose8192@gmail.com>
> >>> Fixes: f72469405eec9 ("datapath: meter: Use struct_size() in kzalloc()")
> >>> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> >>> ---
> >>>    acinclude.m4                                   | 2 ++
> >>>    datapath/linux/compat/include/linux/overflow.h | 2 +-
> >>>    datapath/meter.c                               | 1 +
> >>>    3 files changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/acinclude.m4 b/acinclude.m4
> >>> index 1607d5f4b1d9..548cbe9ef100 100644
> >>> --- a/acinclude.m4
> >>> +++ b/acinclude.m4
> >>> @@ -920,6 +920,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
> >>>                            [OVS_DEFINE([HAVE_INET_FRAGS_RND])])
> >>>      OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H],
> >>>                      [OVS_DEFINE([HAVE_OVERFLOW_H])])
> >>> +  OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size],
> >>> +                  [OVS_DEFINE([HAVE_STRUCT_SIZE])])
> >>>      OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array],
> >>>                      [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])])
> >>>      OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node],
> >>> diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
> >>> index ff84356db16c..8f1b5b005491 100644
> >>> --- a/datapath/linux/compat/include/linux/overflow.h
> >>> +++ b/datapath/linux/compat/include/linux/overflow.h
> >>> @@ -1,5 +1,5 @@
> >>>    /* SPDX-License-Identifier: GPL-2.0 OR MIT */
> >>> -#ifdef HAVE_OVERFLOW_H
> >>> +#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
> >>>    #include_next <linux/overflow.h>
> >>>    #else
> >>>    #ifndef __LINUX_OVERFLOW_H
> >>> diff --git a/datapath/meter.c b/datapath/meter.c
> >>> index 51ec1495033a..eda14682fb96 100644
> >>> --- a/datapath/meter.c
> >>> +++ b/datapath/meter.c
> >>> @@ -13,6 +13,7 @@
> >>>    #include <linux/ip.h>
> >>>    #include <linux/kernel.h>
> >>>    #include <linux/openvswitch.h>
> >>> +#include <linux/overflow.h>
> >>>    #include <linux/netlink.h>
> >>>    #include <linux/rculist.h>
> >>>
> >> Thanks for the patch Yifeng, it looks good but I'm curious because when
> >> I posted the original patch for this it was passing travis build
> >> checks.  Or I thought so at the time.  It bugs me if I missed something.
> >>
> >> In any case I'll give it a quick check and regression test.
> >>
> >> - Greg
>
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 1607d5f4b1d9..548cbe9ef100 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -920,6 +920,8 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                         [OVS_DEFINE([HAVE_INET_FRAGS_RND])])
   OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H],
                   [OVS_DEFINE([HAVE_OVERFLOW_H])])
+  OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size],
+                  [OVS_DEFINE([HAVE_STRUCT_SIZE])])
   OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array],
                   [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])])
   OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node],
diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
index ff84356db16c..8f1b5b005491 100644
--- a/datapath/linux/compat/include/linux/overflow.h
+++ b/datapath/linux/compat/include/linux/overflow.h
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
-#ifdef HAVE_OVERFLOW_H
+#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
 #include_next <linux/overflow.h>
 #else
 #ifndef __LINUX_OVERFLOW_H
diff --git a/datapath/meter.c b/datapath/meter.c
index 51ec1495033a..eda14682fb96 100644
--- a/datapath/meter.c
+++ b/datapath/meter.c
@@ -13,6 +13,7 @@ 
 #include <linux/ip.h>
 #include <linux/kernel.h>
 #include <linux/openvswitch.h>
+#include <linux/overflow.h>
 #include <linux/netlink.h>
 #include <linux/rculist.h>