diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-09-27 06:12:26 +0200 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-09-27 06:12:26 +0200 |
commit | f02b16bea2d8411b21a531fc381e066985895387 (patch) | |
tree | e129e595b978238b2f2c9966acab0cc8a761e0ad | |
parent | [IB] uverbs: Close some exploitable races (diff) | |
download | linux-f02b16bea2d8411b21a531fc381e066985895387.tar.xz linux-f02b16bea2d8411b21a531fc381e066985895387.zip |
[IB] mthca: Round up number of slots in HCA context memory table
When allocating a table for mem-free HCA context, don't assume that
obj_size * nobj is an even multiple of MTHCA_TABLE_CHUNK_SIZE. In
particular, make sure we allocate at least one slot even if the table
is smaller than MTHCA_TABLE_CHUNK_SIZE.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index d0c41fe046f0..7bd7a4bec7b4 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c @@ -290,7 +290,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, int i; u8 status; - num_icm = obj_size * nobj / MTHCA_TABLE_CHUNK_SIZE; + num_icm = (obj_size * nobj + MTHCA_TABLE_CHUNK_SIZE - 1) / MTHCA_TABLE_CHUNK_SIZE; table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL); if (!table) |