diff options
author | Varun Prakash <varun@chelsio.com> | 2017-07-29 17:31:49 +0200 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-07-31 00:35:34 +0200 |
commit | d96adb9b076a12d30500347e2e667689062f44a0 (patch) | |
tree | f9c294b8c5824a197899a712869eb425a1c8c688 /drivers/scsi/qla2xxx/tcm_qla2xxx.c | |
parent | iscsi-target: fix invalid flags in text response (diff) | |
download | linux-d96adb9b076a12d30500347e2e667689062f44a0.tar.xz linux-d96adb9b076a12d30500347e2e667689062f44a0.zip |
cxgbit: fix sg_nents calculation
The current logic of calculating sg_nents can fail
if data_offset % PAGE_SIZE is not zero.
For example -
PAGE_SIZE = 4096
data_len = 3072
data_offset = 3072
As per current logic
sg_nents = max(1UL, DIV_ROUND_UP(data_len, PAGE_SIZE));
sg_nents = max(1UL, DIV_ROUND_UP(3072, 4096));
sg_nents = 1
But as data_offset % PAGE_SIZE = 3072 we should skip 3072 bytes
skip = 3K
sg_nents = max(1UL, DIV_ROUND_UP(3K(skip) + 3K(data_len), 4K(PAGE_SIZE));
sg_nents = 2;
This patch fixes this issue by adding skip to data_len.
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/scsi/qla2xxx/tcm_qla2xxx.c')
0 files changed, 0 insertions, 0 deletions