lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240906182356.GK2097826@kernel.org>
Date: Fri, 6 Sep 2024 19:23:56 +0100
From: Simon Horman <horms@...nel.org>
To: Saeed Mahameed <saeed@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Saeed Mahameed <saeedm@...dia.com>, netdev@...r.kernel.org,
	Tariq Toukan <tariqt@...dia.com>, Gal Pressman <gal@...dia.com>,
	Leon Romanovsky <leonro@...dia.com>,
	Yevgeny Kliteynik <kliteyn@...dia.com>,
	Itamar Gozlan <igozlan@...dia.com>, Mark Bloch <mbloch@...dia.com>
Subject: Re: [net-next V2 11/15] net/mlx5: HWS, added memory management
 handling

On Wed, Sep 04, 2024 at 11:27:46PM -0700, Saeed Mahameed wrote:
> From: Yevgeny Kliteynik <kliteyn@...dia.com>
> 
> Added object pools and buddy allocator functionality.
> 
> Reviewed-by: Itamar Gozlan <igozlan@...dia.com>
> Signed-off-by: Yevgeny Kliteynik <kliteyn@...dia.com>
> Reviewed-by: Mark Bloch <mbloch@...dia.com>
> Signed-off-by: Saeed Mahameed <saeedm@...dia.com>

...

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_pool.c

...

> +static struct mlx5hws_pool_resource *
> +hws_pool_create_one_resource(struct mlx5hws_pool *pool, u32 log_range,
> +			     u32 fw_ft_type)
> +{
> +	struct mlx5hws_cmd_ste_create_attr ste_attr;
> +	struct mlx5hws_cmd_stc_create_attr stc_attr;
> +	struct mlx5hws_pool_resource *resource;
> +	u32 obj_id;
> +	int ret;
> +
> +	resource = kzalloc(sizeof(*resource), GFP_KERNEL);
> +	if (!resource)
> +		return NULL;
> +
> +	switch (pool->type) {
> +	case MLX5HWS_POOL_TYPE_STE:
> +		ste_attr.log_obj_range = log_range;
> +		ste_attr.table_type = fw_ft_type;
> +		ret = mlx5hws_cmd_ste_create(pool->ctx->mdev, &ste_attr, &obj_id);
> +		break;
> +	case MLX5HWS_POOL_TYPE_STC:
> +		stc_attr.log_obj_range = log_range;
> +		stc_attr.table_type = fw_ft_type;
> +		ret = mlx5hws_cmd_stc_create(pool->ctx->mdev, &stc_attr, &obj_id);
> +		break;
> +	default:

Hi Saeed and Yevgeny,

Another minor nit from my side (I think this is the last one).

If we get here, then ret will be used uninitialised by the if condition below.

Also flagged by Smatch.

> +		break;
> +	}
> +
> +	if (ret) {
> +		mlx5hws_err(pool->ctx, "Failed to allocate resource objects\n");
> +		goto free_resource;
> +	}
> +
> +	resource->pool = pool;
> +	resource->range = 1 << log_range;
> +	resource->base_id = obj_id;
> +
> +	return resource;
> +
> +free_resource:
> +	kfree(resource);
> +	return NULL;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ