IB/hfi1: Make n_krcvqs be an unsigned long integer
authorHarish Chegondi <harish.chegondi@intel.com>
Wed, 31 Aug 2016 14:24:40 +0000 (07:24 -0700)
committerDoug Ledford <dledford@redhat.com>
Fri, 2 Sep 2016 18:26:55 +0000 (14:26 -0400)
commit429b6a721727d49d8565b50a6bc0dc42432383a9
tree1e85d4359c97abdf1392fca7474a0eeb5097b565
parent673b975f1fbad5382f76afdb987e7513c5f4b71b
IB/hfi1: Make n_krcvqs be an unsigned long integer

The global variable n_krcvqs stores the sum of the number of kernel
receive queues of VLs 0-7 which the user can pass to the driver through
the module parameter array krcvqs which is of type unsigned integer. If
the user passes large value(s) into krcvqs parameter array, it can cause
an arithmetic overflow while calculating n_krcvqs which is also of type
unsigned int. The overflow results in an incorrect value of n_krcvqs
which can lead to kernel crash while loading the driver.

Fix by changing the data type of n_krcvqs to unsigned long. This patch
also changes the data type of other variables that get their values from
n_krcvqs.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/chip.c
drivers/infiniband/hw/hfi1/hfi.h
drivers/infiniband/hw/hfi1/init.c