diff options
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index a7b0c2dfb3db..d5c25db4398f 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -301,17 +301,14 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, | |||
301 | while (size > 0 && i < sg_size) { | 301 | while (size > 0 && i < sg_size) { |
302 | pg = virt_to_page(addr); | 302 | pg = virt_to_page(addr); |
303 | offset = offset_in_page(addr); | 303 | offset = offset_in_page(addr); |
304 | if (sg) | 304 | sg_set_page(&sg[i], pg, 0, offset); |
305 | sg_set_page(&sg[i], pg, 0, offset); | ||
306 | remainder_of_page = PAGE_CACHE_SIZE - offset; | 305 | remainder_of_page = PAGE_CACHE_SIZE - offset; |
307 | if (size >= remainder_of_page) { | 306 | if (size >= remainder_of_page) { |
308 | if (sg) | 307 | sg[i].length = remainder_of_page; |
309 | sg[i].length = remainder_of_page; | ||
310 | addr += remainder_of_page; | 308 | addr += remainder_of_page; |
311 | size -= remainder_of_page; | 309 | size -= remainder_of_page; |
312 | } else { | 310 | } else { |
313 | if (sg) | 311 | sg[i].length = size; |
314 | sg[i].length = size; | ||
315 | addr += size; | 312 | addr += size; |
316 | size = 0; | 313 | size = 0; |
317 | } | 314 | } |