diff mbox

linux-generic: timer: check for zero timer resolution

Message ID 1428958709-11298-1-git-send-email-ola.liljedahl@linaro.org
State Superseded
Headers show

Commit Message

Ola Liljedahl April 13, 2015, 8:58 p.m. UTC
Fail to create timer pool with zero timer resolution.
https://bugs.linaro.org/show_bug.cgi?id=1451

Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 platform/linux-generic/odp_timer.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mike Holmes April 15, 2015, 3:41 p.m. UTC | #1
On 13 April 2015 at 16:58, Ola Liljedahl <ola.liljedahl@linaro.org> wrote:

> Fail to create timer pool with zero timer resolution.
> https://bugs.linaro.org/show_bug.cgi?id=1451
>
> Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
>

Reviewed-by: Mike Holmes <mike.holmes@linaro.org>

Created https://bugs.linaro.org/show_bug.cgi?id=1469  for the application
args checking



> ---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
>
>  platform/linux-generic/odp_timer.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/platform/linux-generic/odp_timer.c
> b/platform/linux-generic/odp_timer.c
> index 500f7f1..e5391dc 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -691,6 +691,11 @@ odp_timer_pool_create(const char *name,
>                       const odp_timer_pool_param_t *param)
>  {
>         /* Verify that buffer pool can be used for timeouts */
> +       /* Verify that we have a valid (non-zero) timer resolution */
> +       if (param->res_ns == 0) {
> +               __odp_errno = EINVAL;
> +               return NULL;
> +       }
>         odp_timer_pool_t tp = odp_timer_pool_new(name, param);
>         return tp;
>  }
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 500f7f1..e5391dc 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -691,6 +691,11 @@  odp_timer_pool_create(const char *name,
 		      const odp_timer_pool_param_t *param)
 {
 	/* Verify that buffer pool can be used for timeouts */
+	/* Verify that we have a valid (non-zero) timer resolution */
+	if (param->res_ns == 0) {
+		__odp_errno = EINVAL;
+		return NULL;
+	}
 	odp_timer_pool_t tp = odp_timer_pool_new(name, param);
 	return tp;
 }