From: Roland Dreier Date: Wed, 10 Oct 2007 02:59:18 +0000 (-0700) Subject: IB/ehca: Fix clipping of device limits to INT_MAX X-Git-Tag: v2.6.24-rc1~1453^2~26 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76dea3bc2644e99cce1d98d0bbd3124314e5b50a;p=pandora-kernel.git IB/ehca: Fix clipping of device limits to INT_MAX Doing min_t(int, foo, INT_MAX) doesn't work correctly, because if foo is bigger than INT_MAX, then when treated as a signed integer, it will become negative and hence such an expression is just an elaborate NOP. Fix such cases in ehca to do min_t(unsigned, foo, INT_MAX) instead. This fixes negative reported values for max_cqe, max_pd and max_ah: Before: max_cqe: -64 max_pd: -1 max_ah: -1 After: max_cqe: 2147483647 max_pd: 2147483647 max_ah: 2147483647 Based on a bug report and fix from Anton Blanchard . Signed-off-by: Roland Dreier --- Reading git-diff-tree failed