mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
This commit is contained in:
parent
63c47c286d
commit
f02b16bea2
1 changed files with 1 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue