diff options
author | Roland Dreier <rolandd@cisco.com> | 2008-04-17 08:01:13 +0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 08:01:13 +0400 |
commit | 19773539d6369c54fbb0c870de0c75417b0020d1 (patch) | |
tree | cf1f05517a3aa68fd13f2e2a18389316d0420379 /drivers/infiniband/hw/mthca/mthca_profile.h | |
parent | f4f82994d1ea0cd01058a245985f1eb5e569e6d3 (diff) | |
download | linux-19773539d6369c54fbb0c870de0c75417b0020d1.tar.xz |
IB/mthca: Avoid integer overflow when dealing with profile size
mthca_make_profile() returns the size in bytes of the HCA context
layout it creates, or a negative value if an error occurs. However,
the return value is declared as u64 and the memfree initialization
path casts this value to int to test if it is negative. This makes it
think incorrectly than an error has occurred if the context size
happens to be bigger than 2GB, since this turns into a negative int.
Fix this by having mthca_make_profile() return an s64 and testing
for an error by checking whether this 64-bit value itself is negative.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_profile.h')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_profile.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_profile.h b/drivers/infiniband/hw/mthca/mthca_profile.h index 94641808f97f..e76cb62d8e32 100644 --- a/drivers/infiniband/hw/mthca/mthca_profile.h +++ b/drivers/infiniband/hw/mthca/mthca_profile.h @@ -53,7 +53,7 @@ struct mthca_profile { int fmr_reserved_mtts; }; -u64 mthca_make_profile(struct mthca_dev *mdev, +s64 mthca_make_profile(struct mthca_dev *mdev, struct mthca_profile *request, struct mthca_dev_lim *dev_lim, struct mthca_init_hca_param *init_hca); |