diff mbox

linux-generic: pool: check for NULL params before dereference

Message ID 1427973116-14859-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit 8b5269aad139def070890f1d05a25be9b51c0976
Headers show

Commit Message

Stuart Haslam April 2, 2015, 11:11 a.m. UTC
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/odp_pool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bill Fischofer April 2, 2015, 9:10 p.m. UTC | #1
On Thu, Apr 2, 2015 at 6:11 AM, Stuart Haslam <stuart.haslam@linaro.org>
wrote:

> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  platform/linux-generic/odp_pool.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/odp_pool.c
> b/platform/linux-generic/odp_pool.c
> index 468b7a5..bf49623 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -143,6 +143,9 @@ odp_pool_t odp_pool_create(const char *name,
>         pool_entry_t *pool;
>         uint32_t i, headroom = 0, tailroom = 0;
>
> +       if (params == NULL)
> +               return ODP_POOL_INVALID;
> +
>         /* Default size and align for timeouts */
>         if (params->type == ODP_POOL_TIMEOUT) {
>                 params->buf.size  = 0; /* tmo.__res1 */
> @@ -158,9 +161,6 @@ odp_pool_t odp_pool_create(const char *name,
>
>         _odp_buffer_pool_init_t *init_params = &default_init_params;
>
> -       if (params == NULL)
> -               return ODP_POOL_INVALID;
> -
>         /* Restriction for v1.0: All non-packet buffers are unsegmented */
>         int unseg = 1;
>
> --
> 2.1.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov April 3, 2015, 11:58 a.m. UTC | #2
Merged,
Maxim.

On 04/03/15 00:10, Bill Fischofer wrote:
>
>
> On Thu, Apr 2, 2015 at 6:11 AM, Stuart Haslam 
> <stuart.haslam@linaro.org <mailto:stuart.haslam@linaro.org>> wrote:
>
>     Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org
>     <mailto:stuart.haslam@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      platform/linux-generic/odp_pool.c | 6 +++---
>      1 file changed, 3 insertions(+), 3 deletions(-)
>
>     diff --git a/platform/linux-generic/odp_pool.c
>     b/platform/linux-generic/odp_pool.c
>     index 468b7a5..bf49623 100644
>     --- a/platform/linux-generic/odp_pool.c
>     +++ b/platform/linux-generic/odp_pool.c
>     @@ -143,6 +143,9 @@ odp_pool_t odp_pool_create(const char *name,
>             pool_entry_t *pool;
>             uint32_t i, headroom = 0, tailroom = 0;
>
>     +       if (params == NULL)
>     +               return ODP_POOL_INVALID;
>     +
>             /* Default size and align for timeouts */
>             if (params->type == ODP_POOL_TIMEOUT) {
>                     params->buf.size  = 0; /* tmo.__res1 */
>     @@ -158,9 +161,6 @@ odp_pool_t odp_pool_create(const char *name,
>
>             _odp_buffer_pool_init_t *init_params = &default_init_params;
>
>     -       if (params == NULL)
>     -               return ODP_POOL_INVALID;
>     -
>             /* Restriction for v1.0: All non-packet buffers are
>     unsegmented */
>             int unseg = 1;
>
>     --
>     2.1.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> 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_pool.c b/platform/linux-generic/odp_pool.c
index 468b7a5..bf49623 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -143,6 +143,9 @@  odp_pool_t odp_pool_create(const char *name,
 	pool_entry_t *pool;
 	uint32_t i, headroom = 0, tailroom = 0;
 
+	if (params == NULL)
+		return ODP_POOL_INVALID;
+
 	/* Default size and align for timeouts */
 	if (params->type == ODP_POOL_TIMEOUT) {
 		params->buf.size  = 0; /* tmo.__res1 */
@@ -158,9 +161,6 @@  odp_pool_t odp_pool_create(const char *name,
 
 	_odp_buffer_pool_init_t *init_params = &default_init_params;
 
-	if (params == NULL)
-		return ODP_POOL_INVALID;
-
 	/* Restriction for v1.0: All non-packet buffers are unsegmented */
 	int unseg = 1;