mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
target/sbc: Fix sbc_dif_copy_prot addr offset bug
This patch fixes a bug in sbc_dif_copy_prot() where the updated addr offset did not take into account the case where the associated scatterlist had not been incremented. This addresses the case where incoming protection scatterlists may contain a length smaller than PAGE_SIZE across multiple entires, when the target protection scatterlists are always being explicitly filled up to PAGE_SIZE before adding another entry. Cc: Martin K. Petersen <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Or Gerlitz <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
84197a36e9
commit
10762e8048
1 changed files with 2 additions and 3 deletions
|
|
@ -1074,7 +1074,7 @@ 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;
|
||||
unsigned int offset = sg_off;
|
||||
|
||||
left = sectors * dev->prot_length;
|
||||
|
||||
|
|
@ -1084,11 +1084,10 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read,
|
|||
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;
|
||||
addr = kmap_atomic(sg_page(sg)) + sg->offset + offset;
|
||||
|
||||
if (read)
|
||||
memcpy(paddr, addr, len);
|
||||
|
|
|
|||
Loading…
Reference in a new issue