summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-10-11 10:48:45 -0700
committerDoug Ledford <dledford@redhat.com>2017-10-14 20:47:05 -0400
commitc0b64f58e8d49570aa9ee55d880f92c20ff0166b (patch)
treeb1017ce60e242ef0c849e49c21049ba1607e9d86 /drivers/infiniband/ulp
parent401c6ae363bdc66e724b4589881a0c0ffc9d7775 (diff)
downloadop-kernel-dev-c0b64f58e8d49570aa9ee55d880f92c20ff0166b.zip
op-kernel-dev-c0b64f58e8d49570aa9ee55d880f92c20ff0166b.tar.gz
RDMA/cma: Avoid triggering undefined behavior
According to the C standard the behavior of computations with integer operands is as follows: * A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type. * The behavior for signed integer underflow and overflow is undefined. Hence only use unsigned integers when checking for integer overflow. This patch is what I came up with after having analyzed the following smatch warnings: drivers/infiniband/core/cma.c:3448: cma_resolve_ib_udp() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len' drivers/infiniband/core/cma.c:3505: cma_connect_ib() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len' Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Acked-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud