aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/target_core_user.c')
-rw-r--r--drivers/target/target_core_user.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 80ee130f8253..942d094269fb 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -563,8 +563,6 @@ static int scatter_data_area(struct tcmu_dev *udev,
563 block_remaining); 563 block_remaining);
564 to_offset = get_block_offset_user(udev, dbi, 564 to_offset = get_block_offset_user(udev, dbi,
565 block_remaining); 565 block_remaining);
566 offset = DATA_BLOCK_SIZE - block_remaining;
567 to += offset;
568 566
569 if (*iov_cnt != 0 && 567 if (*iov_cnt != 0 &&
570 to_offset == iov_tail(*iov)) { 568 to_offset == iov_tail(*iov)) {
@@ -575,8 +573,10 @@ static int scatter_data_area(struct tcmu_dev *udev,
575 (*iov)->iov_len = copy_bytes; 573 (*iov)->iov_len = copy_bytes;
576 } 574 }
577 if (copy_data) { 575 if (copy_data) {
578 memcpy(to, from + sg->length - sg_remaining, 576 offset = DATA_BLOCK_SIZE - block_remaining;
579 copy_bytes); 577 memcpy(to + offset,
578 from + sg->length - sg_remaining,
579 copy_bytes);
580 tcmu_flush_dcache_range(to, copy_bytes); 580 tcmu_flush_dcache_range(to, copy_bytes);
581 } 581 }
582 sg_remaining -= copy_bytes; 582 sg_remaining -= copy_bytes;
@@ -637,9 +637,8 @@ static void gather_data_area(struct tcmu_dev *udev, struct tcmu_cmd *cmd,
637 copy_bytes = min_t(size_t, sg_remaining, 637 copy_bytes = min_t(size_t, sg_remaining,
638 block_remaining); 638 block_remaining);
639 offset = DATA_BLOCK_SIZE - block_remaining; 639 offset = DATA_BLOCK_SIZE - block_remaining;
640 from += offset;
641 tcmu_flush_dcache_range(from, copy_bytes); 640 tcmu_flush_dcache_range(from, copy_bytes);
642 memcpy(to + sg->length - sg_remaining, from, 641 memcpy(to + sg->length - sg_remaining, from + offset,
643 copy_bytes); 642 copy_bytes);
644 643
645 sg_remaining -= copy_bytes; 644 sg_remaining -= copy_bytes;
@@ -1433,6 +1432,8 @@ static int tcmu_update_uio_info(struct tcmu_dev *udev)
1433 if (udev->dev_config[0]) 1432 if (udev->dev_config[0])
1434 snprintf(str + used, size - used, "/%s", udev->dev_config); 1433 snprintf(str + used, size - used, "/%s", udev->dev_config);
1435 1434
1435 /* If the old string exists, free it */
1436 kfree(info->name);
1436 info->name = str; 1437 info->name = str;
1437 1438
1438 return 0; 1439 return 0;