diff options
-rw-r--r-- | drivers/target/target_core_sbc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 26a6d183ccb1..a664c664a31a 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -58,11 +58,10 @@ sbc_emulate_readcapacity(struct se_cmd *cmd) | |||
58 | buf[7] = dev->dev_attrib.block_size & 0xff; | 58 | buf[7] = dev->dev_attrib.block_size & 0xff; |
59 | 59 | ||
60 | rbuf = transport_kmap_data_sg(cmd); | 60 | rbuf = transport_kmap_data_sg(cmd); |
61 | if (!rbuf) | 61 | if (rbuf) { |
62 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 62 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
63 | 63 | transport_kunmap_data_sg(cmd); | |
64 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | 64 | } |
65 | transport_kunmap_data_sg(cmd); | ||
66 | 65 | ||
67 | target_complete_cmd(cmd, GOOD); | 66 | target_complete_cmd(cmd, GOOD); |
68 | return 0; | 67 | return 0; |
@@ -97,11 +96,10 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd) | |||
97 | buf[14] = 0x80; | 96 | buf[14] = 0x80; |
98 | 97 | ||
99 | rbuf = transport_kmap_data_sg(cmd); | 98 | rbuf = transport_kmap_data_sg(cmd); |
100 | if (!rbuf) | 99 | if (rbuf) { |
101 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 100 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
102 | 101 | transport_kunmap_data_sg(cmd); | |
103 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | 102 | } |
104 | transport_kunmap_data_sg(cmd); | ||
105 | 103 | ||
106 | target_complete_cmd(cmd, GOOD); | 104 | target_complete_cmd(cmd, GOOD); |
107 | return 0; | 105 | return 0; |