On Sat, 2017-07-29 at 21:01 +0530, Varun Prakash wrote: > 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@xxxxxxxxxxx> > --- > drivers/target/iscsi/cxgbit/cxgbit_target.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > Applied to target-pending/master. Thanks Varun. -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html