diff mbox series

[ovs-dev,v3,8/8] netdev-linux: Fix uninitialized gso_type case.

Message ID e55d5c8ac072a2baefe68505a923c6c71b44a0ac.1716979680.git.echaudro@redhat.com
State Accepted
Commit f2e4195b0c87e4c80d7e4031516beea7133d1338
Headers show
Series Coverity fixes. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Eelco Chaudron May 29, 2024, 10:53 a.m. UTC
This patch fixes an uninitialized gso_type case in
netdev_linux_prepend_vnet_hdr() by returning an error.

Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/netdev-linux.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ilya Maximets May 29, 2024, 8:21 p.m. UTC | #1
On 5/29/24 12:53, Eelco Chaudron wrote:
> This patch fixes an uninitialized gso_type case in
> netdev_linux_prepend_vnet_hdr() by returning an error.
> 
> Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---

Recheck-request: github-robot
Eelco Chaudron May 30, 2024, 7:27 a.m. UTC | #2
On 29 May 2024, at 12:53, Eelco Chaudron wrote:

> This patch fixes an uninitialized gso_type case in
> netdev_linux_prepend_vnet_hdr() by returning an error.
>
> Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  lib/netdev-linux.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index eb0c5c624..dc67e1268 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -7167,6 +7167,10 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *b, int mtu)
>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
>          } else if (dp_packet_hwol_tx_ipv6(b)) {
>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
> +        } else {
> +            VLOG_ERR_RL(&rl, "Unknown gso_type for TSO packet. Flags: %"PRIx64,
> +                        (uint64_t) *dp_packet_ol_flags_ptr(b));
> +            return EINVAL;
>          }
>      } else {
>          vnet->hdr_len = 0;
> -- 
> 2.44.0

Recheck-request: github-robot
Ilya Maximets May 31, 2024, 11:37 a.m. UTC | #3
On 5/29/24 12:53, Eelco Chaudron wrote:
> This patch fixes an uninitialized gso_type case in
> netdev_linux_prepend_vnet_hdr() by returning an error.
> 
> Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  lib/netdev-linux.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index eb0c5c624..dc67e1268 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -7167,6 +7167,10 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *b, int mtu)
>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
>          } else if (dp_packet_hwol_tx_ipv6(b)) {
>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
> +        } else {
> +            VLOG_ERR_RL(&rl, "Unknown gso_type for TSO packet. Flags: %"PRIx64,

I'd suggest adding the # qualifier to the format string, i.e. %#"PRIx64.
Can be fixed on commit, I suppose.

Acked-by: Ilya Maximets <i.maximets@ovn.org>
Eelco Chaudron June 3, 2024, 11:12 a.m. UTC | #4
On 31 May 2024, at 13:37, Ilya Maximets wrote:

> On 5/29/24 12:53, Eelco Chaudron wrote:
>> This patch fixes an uninitialized gso_type case in
>> netdev_linux_prepend_vnet_hdr() by returning an error.
>>
>> Fixes: 3337e6d91c5b ("userspace: Enable L4 checksum offloading by default.")
>> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
>> ---
>>  lib/netdev-linux.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
>> index eb0c5c624..dc67e1268 100644
>> --- a/lib/netdev-linux.c
>> +++ b/lib/netdev-linux.c
>> @@ -7167,6 +7167,10 @@ netdev_linux_prepend_vnet_hdr(struct dp_packet *b, int mtu)
>>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
>>          } else if (dp_packet_hwol_tx_ipv6(b)) {
>>              vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
>> +        } else {
>> +            VLOG_ERR_RL(&rl, "Unknown gso_type for TSO packet. Flags: %"PRIx64,
>
> I'd suggest adding the # qualifier to the format string, i.e. %#"PRIx64.
> Can be fixed on commit, I suppose.

Thanks for the review! I’ll fix on commit, as I totally missed the # sign :(.

> Acked-by: Ilya Maximets <i.maximets@ovn.org>
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index eb0c5c624..dc67e1268 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -7167,6 +7167,10 @@  netdev_linux_prepend_vnet_hdr(struct dp_packet *b, int mtu)
             vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
         } else if (dp_packet_hwol_tx_ipv6(b)) {
             vnet->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
+        } else {
+            VLOG_ERR_RL(&rl, "Unknown gso_type for TSO packet. Flags: %"PRIx64,
+                        (uint64_t) *dp_packet_ol_flags_ptr(b));
+            return EINVAL;
         }
     } else {
         vnet->hdr_len = 0;