diff mbox

[PATCHv3,2/3] linux-generic: queue: add queue_is_destroyed internal call

Message ID 1426673799-28116-3-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu March 18, 2015, 10:16 a.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-generic/include/odp_queue_internal.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Ola Liljedahl March 18, 2015, 4:12 p.m. UTC | #1
On 18 March 2015 at 11:16, Ciprian Barbu <ciprian.barbu@linaro.org> wrote:

> Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
> ---
>  platform/linux-generic/include/odp_queue_internal.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/platform/linux-generic/include/odp_queue_internal.h
> b/platform/linux-generic/include/odp_queue_internal.h
> index 65aae14..9a0e94f 100644
> --- a/platform/linux-generic/include/odp_queue_internal.h
> +++ b/platform/linux-generic/include/odp_queue_internal.h
> @@ -139,6 +139,15 @@ static inline int queue_is_sched(odp_queue_t handle)
>         return ((queue->s.status == QUEUE_STATUS_SCHED) &&
>                 (queue->s.pktin != ODP_PKTIO_INVALID));
>  }
> +
> +static inline int queue_is_destroyed(odp_queue_t handle)
> +{
> +       queue_entry_t *queue;
> +
> +       queue = queue_to_qentry(handle);
>
What is returned if handle does not specify any current or prior existing
queue? Null?

> +
> +       return (queue->s.status == QUEUE_STATUS_DESTROYED);
>
Potential null pointer dereference?

Possibly this code is OK due to the internal implementation and behavior of
queues in linux-generic. But just looking at this patch in isolation it
seems questionable.

+}
>  #ifdef __cplusplus
>  }
>  #endif
> --
> 1.8.3.2
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h
index 65aae14..9a0e94f 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -139,6 +139,15 @@  static inline int queue_is_sched(odp_queue_t handle)
 	return ((queue->s.status == QUEUE_STATUS_SCHED) &&
 		(queue->s.pktin != ODP_PKTIO_INVALID));
 }
+
+static inline int queue_is_destroyed(odp_queue_t handle)
+{
+	queue_entry_t *queue;
+
+	queue = queue_to_qentry(handle);
+
+	return (queue->s.status == QUEUE_STATUS_DESTROYED);
+}
 #ifdef __cplusplus
 }
 #endif