IB/rdmavt: Check lkey_table_size value before use
authorJubin John <jubin.john@intel.com>
Fri, 26 Feb 2016 21:33:08 +0000 (13:33 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:45:45 +0000 (20:45 -0500)
commitade302405f333af834c5a272f905000810adf474
tree55eca17fe79c3f190bc9a13dce9e5670996c8d81
parent582e05c3deeaf56ed04df62ad9f1fa6e88199bd9
IB/rdmavt: Check lkey_table_size value before use

The lkey_table_size driver specific parameter value is used before its
value is sanity checked and restricted to RVT_MAX_LKEY_TABLE_BITS.

This causes a vmalloc allocation failure for large values. Fix this
by moving the value check before the first usage of the value.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rdmavt/mr.c