Skip to contentSkip to conversation

ring: squash gcc 12.2.1 warnings

PATCH David Marchand 2 participants 3 messages Mar 16, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 22 lines · Kevin Traynor

gcc 12.2.1 on Fedora 37 is giving stringop-overread and stringop-overflow warnings when compiled with --buildtype=debug e.g. [1].

These are not yet fixed on main branch. They look similar
to the overflow issues previously squashed in rte_memcpy with commit b5b3ea803e47 ("eal/x86: ignore gcc 10 stringop-overflow warnings")

In order to ensure DPDK 21.11.3 compiles on Fedora 37, squash these warnings. If a subsequent cleaner fix becomes available on from main branch it can be backported to later DPDK 21.11 LTS release.

[1]
lib/ring/rte_ring_elem_pvt.h:100:25: error:
‘memcpy’ reading 32 bytes from a region of size 4
[-Werror=stringop-overread]

100 |               memcpy((void *)(ring + idx),
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 |                       (const void *)(obj + i), 32);
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines

lib/ring/rte_ring_elem_pvt.h:234:25: error:
‘memcpy’ writing 32 bytes into a region of size 4 overflows the destination [-Werror=stringop-overflow=]

234 |               memcpy((void *)(obj + i), (void *)(ring + idx), 32);
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As mentionned in this thread:
https://inbox.dpdk.org/dev/[email protected]/T/#me1c8f06a9ca2cf2a4ed4a028d373a3e3ce5146d1
I intend to pull this change in the main repository and mark this change for backports in other stable branches.

I'll do this for -rc3, expected tomorrow, unless someone objects.

Signature · 1 line
David Marchand
#2 lore raw
Quoted 33 lines · Kevin Traynor
Quoted 22 lines

gcc 12.2.1 on Fedora 37 is giving stringop-overread and stringop-overflow warnings when compiled with --buildtype=debug e.g. [1].

These are not yet fixed on main branch. They look similar
to the overflow issues previously squashed in rte_memcpy with commit b5b3ea803e47 ("eal/x86: ignore gcc 10 stringop-overflow warnings")

In order to ensure DPDK 21.11.3 compiles on Fedora 37, squash these warnings. If a subsequent cleaner fix becomes available on from main branch it can be backported to later DPDK 21.11 LTS release.

[1]
lib/ring/rte_ring_elem_pvt.h:100:25: error:
‘memcpy’ reading 32 bytes from a region of size 4
[-Werror=stringop-overread]

100 |               memcpy((void *)(ring + idx),
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 |                       (const void *)(obj + i), 32);
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines

lib/ring/rte_ring_elem_pvt.h:234:25: error:
‘memcpy’ writing 32 bytes into a region of size 4 overflows the destination [-Werror=stringop-overflow=]

234 |               memcpy((void *)(obj + i), (void *)(ring + idx), 32);
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines

As mentionned in this thread:
https://inbox.dpdk.org/dev/ZBLqF6c3ujMic45N@bricha3-
MOBL.ger.corp.intel.com/T/#me1c8f06a9ca2cf2a4ed4a028d373a3e3ce5146d1 I intend to pull this change in the main repository and mark this change for backports in other stable branches.

I'll do this for -rc3, expected tomorrow, unless someone objects.

No objections.
Thanks
Konstantin

#3 lore raw
In reply to David Marchand
Quoted 24 lines · David Marchand
Quoted 22 lines · Kevin Traynor

gcc 12.2.1 on Fedora 37 is giving stringop-overread and stringop-overflow warnings when compiled with --buildtype=debug e.g. [1].

These are not yet fixed on main branch. They look similar
to the overflow issues previously squashed in rte_memcpy with commit b5b3ea803e47 ("eal/x86: ignore gcc 10 stringop-overflow warnings")

In order to ensure DPDK 21.11.3 compiles on Fedora 37, squash these warnings. If a subsequent cleaner fix becomes available on from main branch it can be backported to later DPDK 21.11 LTS release.

[1]
lib/ring/rte_ring_elem_pvt.h:100:25: error:
‘memcpy’ reading 32 bytes from a region of size 4
[-Werror=stringop-overread]

100 |               memcpy((void *)(ring + idx),
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 |                       (const void *)(obj + i), 32);
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines
Quoted 7 lines

lib/ring/rte_ring_elem_pvt.h:234:25: error:
‘memcpy’ writing 32 bytes into a region of size 4 overflows the destination [-Werror=stringop-overflow=]

234 |               memcpy((void *)(obj + i), (void *)(ring + idx), 32);
    |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I see Konstantin is ok with it and I think Honnappa is off for some days. So I adjusted the commitlog for the main branch, and applied.

For the record, there is a bugzilla opened for this issue:
https://bugs.dpdk.org/show_bug.cgi?id=1062

Signature · 1 line
David Marchand