[ovs-git] [openvswitch/ovs] fdef31: hash: Fix compilation error on Fedora 34 with GCC ...

Ilya Maximets noreply at github.com
Wed Sep 15 22:24:35 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: fdef31fb7eff91e1369873093165178f8013a76e
      https://github.com/openvswitch/ovs/commit/fdef31fb7eff91e1369873093165178f8013a76e
  Author: Guzowski Adrian <adrian.guzowski at exatel.pl>
  Date:   2021-09-15 (Wed, 15 Sep 2021)

  Changed paths:
    M lib/hash.c
    M lib/hash.h

  Log Message:
  -----------
  hash: Fix compilation error on Fedora 34 with GCC 11 and -O0.

With newest version of GCC, OVS fails to compile with -O0 due to
false-positive overread detection in hash-related functions.  Those
function declares "const uint32_t p[]" as argument and it throws off
the compiler into thinking that it reads from memory region of size 0.

To fix that behavior, a change in argument declaration needs to be made:
instead of using "[]" notation for a pointer, simply use "*".

The reported error in question:

lib/conntrack.c: In function ‘conn_key_hash’:
lib/conntrack.c:2154:12: error: ‘hash_words’ reading 4 bytes \
                   from a region of size 0 [-Werror=stringop-overread]
 2154| return hash_words((uint32_t *) (&key->dst + 1),
     |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2155|                   (uint32_t *) (key + 1) - (uint32_t *) (&key->dst + 1),
     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2156|                   hash);
     |                   ~~~~~
lib/conntrack.c:2154:12: note: referencing argument 1 \
        of type ‘const uint32_t *’ {aka ‘const unsigned int *’}
In file included from lib/packets.h:31,
                 from lib/ct-dpif.h:21,
                 from lib/conntrack.h:23,
                 from lib/conntrack.c:26:
lib/hash.h:294:1: note: in a call to function ‘hash_words’
  294 | hash_words(const uint32_t p[], size_t n_words, uint32_t basis)
      | ^~~~~~~~~~

Signed-off-by: Guzowski Adrian <adrian.guzowski at exatel.pl>
Tested-by: Numan Siddique <numans at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>


  Commit: a2fa8b2895543a4282c5f494d8825de283ebc349
      https://github.com/openvswitch/ovs/commit/a2fa8b2895543a4282c5f494d8825de283ebc349
  Author: wenxu <wenxu at ucloud.cn>
  Date:   2021-09-16 (Thu, 16 Sep 2021)

  Changed paths:
    M lib/conntrack-private.h
    M lib/conntrack.c

  Log Message:
  -----------
  conntrack: Remove the nat_action_info from the conn.

Only 'nat_action_info->nat_action' is used for packet forwarding.
Other items such as min/max_ip/port are used only when creating
new connections. No need to store the whole nat_action_info in conn.

Signed-off-by: wenxu <wenxu at ucloud.cn>
Acked-by: Gaetan Rivet <grive at u256.net>
Acked-by: Michael Santana <msantana at redhat.com>
Acked-by: Aaron Conole <aconole at redhat.com>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/ebcbb534e192...a2fa8b289554


More information about the git mailing list