diff mbox series

[ovs-dev,3/7] dpif: Fix potential NULL pointer access in log_flow_message().

Message ID 948e855448fbaa994e45e06e76b9eef037a95b25.1724849996.git.echaudro@redhat.com
State Accepted
Commit c9036248853f7c62b1f86aba87111a7d2e0c16b7
Delegated to: Eelco Chaudron
Headers show
Series Series fixing some issues reported by Coverity. | expand

Checks

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

Commit Message

Eelco Chaudron Aug. 28, 2024, 1:28 p.m. UTC
When actions is NULL and action_len is not zero, it would
potentially allow format_odp_actions() to dereference the
NULL pointer. The fix will check for valid actions pointer
only, as format_odp_actions() will handle a zero length.

Fixes: cdee00fd635d ("datapath: Replace "struct odp_action" by Netlink attributes.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/dpif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Aaron Conole Aug. 28, 2024, 2:49 p.m. UTC | #1
Eelco Chaudron <echaudro@redhat.com> writes:

> When actions is NULL and action_len is not zero, it would
> potentially allow format_odp_actions() to dereference the
> NULL pointer. The fix will check for valid actions pointer
> only, as format_odp_actions() will handle a zero length.
>
> Fixes: cdee00fd635d ("datapath: Replace "struct odp_action" by Netlink attributes.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>

>  lib/dpif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/dpif.c b/lib/dpif.c
> index ab633fd27..245c8b5ee 100644
> --- a/lib/dpif.c
> +++ b/lib/dpif.c
> @@ -1810,7 +1810,7 @@ log_flow_message(const struct dpif *dpif, int error,
>          ds_put_cstr(&ds, ", ");
>          dpif_flow_stats_format(stats, &ds);
>      }
> -    if (actions || actions_len) {
> +    if (actions) {
>          ds_put_cstr(&ds, ", actions:");
>          format_odp_actions(&ds, actions, actions_len, NULL);
>      }
diff mbox series

Patch

diff --git a/lib/dpif.c b/lib/dpif.c
index ab633fd27..245c8b5ee 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1810,7 +1810,7 @@  log_flow_message(const struct dpif *dpif, int error,
         ds_put_cstr(&ds, ", ");
         dpif_flow_stats_format(stats, &ds);
     }
-    if (actions || actions_len) {
+    if (actions) {
         ds_put_cstr(&ds, ", actions:");
         format_odp_actions(&ds, actions, actions_len, NULL);
     }