On Wed, 2014-02-12 at 11:40 +0200, sagig@xxxxxxxxxxxxxxxx wrote: > From: Sagi Grimberg <sagig@xxxxxxxxxxxx> > > Need to take into account that protection sg_list > (copy-buffer) may consist of multiple entries. > > Changes from v0: > - Changed commit description > > Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx> > --- Nice catch Sagi! Applied to target-pending/queue, and will include in the next -rc3 PULL request. --nab > drivers/target/target_core_sbc.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c > index 71f91ff..fac8c77 100644 > --- a/drivers/target/target_core_sbc.c > +++ b/drivers/target/target_core_sbc.c > @@ -1147,12 +1147,19 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, > struct scatterlist *psg; > void *paddr, *addr; > unsigned int i, len, left; > + unsigned int offset = 0; > > left = sectors * dev->prot_length; > > for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { > > len = min(psg->length, left); > + if (offset >= sg->length) { > + sg = sg_next(sg); > + offset = 0; > + sg_off = sg->offset; > + } > + > paddr = kmap_atomic(sg_page(psg)) + psg->offset; > addr = kmap_atomic(sg_page(sg)) + sg_off; > > @@ -1162,6 +1169,7 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, > memcpy(addr, paddr, len); > > left -= len; > + offset += len; > kunmap_atomic(paddr); > kunmap_atomic(addr); > } -- 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