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: <1372885804.1886.22.camel@joe-AO722>
Date:	Wed, 03 Jul 2013 14:10:04 -0700
From:	Joe Perches <joe@...ches.com>
To:	Or Gerlitz <ogerlitz@...lanox.com>
Cc:	roland@...nel.org, linux-rdma@...r.kernel.org,
	netdev@...r.kernel.org, davem@...emloft.net,
	jackm@....mellanox.co.il, eli@....mellanox.co.il,
	moshel@...lanox.com, Eli Cohen <eli@...lanox.com>
Subject: Re: [PATCH V2 7/9] IB/mlx5: Mellanox Connect-IB, IB driver part 3/5

On Wed, 2013-07-03 at 20:13 +0300, Or Gerlitz wrote:
> From: Eli Cohen <eli@...lanox.com>

More trivia:

> diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
[]
> +#define mlx5_ib_dbg(dev, format, arg...)				\
> +do {									\
> +	pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name,	\
> +		 __func__, __LINE__, current->pid, ##arg);		\
> +} while (0)

unnecessary do {} while (0)

> +static void clean_keys(struct mlx5_ib_dev *dev, int c)
> +{
> +	struct device *ddev = dev->ib_dev.dma_device;
> +	struct mlx5_mr_cache *cache = &dev->cache;
> +	struct mlx5_cache_ent *ent = &cache->ent[c];
> +	struct mlx5_ib_mr *mr;
> +	int size;
> +	int err;
> +
> +	while (1) {
> +		spin_lock(&ent->lock);
> +		if (list_empty(&ent->head)) {
> +			spin_unlock(&ent->lock);
> +			return;
> +		}
> +		mr = list_first_entry(&ent->head, struct mlx5_ib_mr, list);
> +		list_del(&mr->list);
> +		ent->cur--;
> +		ent->size--;
> +		spin_unlock(&ent->lock);
> +		err = mlx5_core_destroy_mkey(&dev->mdev, &mr->mmr);
> +		if (err) {
> +			mlx5_ib_warn(dev, "failed destroy mkey\n");

Are you leaking anything here by not freeing?

> +		} else {
> +			size = ALIGN(sizeof(u64) * (1 << mr->order), 0x40);
> +			dma_unmap_single(ddev, mr->dma, size, DMA_TO_DEVICE);
> +			kfree(mr->pas);
> +			kfree(mr);
> +		}
> +	};
> +}

> +static struct mlx5_ib_mr *reg_create(struct ib_pd *pd, u64 virt_addr,
> +				     u64 length, struct ib_umem *umem,
> +				     int npages, int page_shift,
> +				     int access_flags)
> +{
[]
> +	mr = kzalloc(sizeof(*mr), GFP_KERNEL);
> +	if (!mr) {
> +		mlx5_ib_warn(dev, "allocation failed\n");

Another unnecessary OOM

> +		mr = ERR_PTR(-ENOMEM);
> +	}
> +
> +	inlen = sizeof(*in) + sizeof(*in->pas) * ((npages + 1) / 2) * 2;
> +	in = vzalloc(inlen);
> +	if (!in) {
> +		mlx5_ib_warn(dev, "alloc failed\n");

here too.

> +		err = -ENOMEM;
> +		goto err_1;
> +	}


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ