]> git.baikalelectronics.ru Git - kernel.git/commit
IB/hfi1: Fix SGE length for misaligned PIO copy
authorSebastian Sanchez <sebastian.sanchez@intel.com>
Wed, 31 Aug 2016 14:24:20 +0000 (07:24 -0700)
committerDoug Ledford <dledford@redhat.com>
Fri, 2 Sep 2016 18:26:55 +0000 (14:26 -0400)
commit0926d76b8c0a3474dc54d7ded7a5e2a7dcdf4bb2
tree8da26c5cc4aeb30f5bda09a0023ba6144208db4f
parent3f43e30a7a1b6f6c3f5601e0ebf739ffe78f3baf
IB/hfi1: Fix SGE length for misaligned PIO copy

When trying to align the source pointer and there's a byte carry
in an SGE copy, bytes are borrowed from the next quad-word X to
complete the required quad-word copy. Then, the SGE length is
reduced by the number of borrowed bytes. After this, if the
remaining number of bytes from quad-word X (extra bytes) is
greater than the new SGE length, the number of extra bytes needs
to be updated to the new SGE length. Otherwise, when the
SGE length gets updated again after the extra bytes are read to
create the new byte carry, it goes negative, which then becomes
a very large number as the SGE length is an unsigned integer.
This causes SGE buffer to be over-read.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/pio_copy.c