diff options
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r-- | crypto/scatterwalk.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index b9bbda0bb9f9..9aeeb52004a5 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | |||
17 | #include <crypto/scatterwalk.h> | ||
16 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
17 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -20,9 +22,6 @@ | |||
20 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
21 | #include <linux/scatterlist.h> | 23 | #include <linux/scatterlist.h> |
22 | 24 | ||
23 | #include "internal.h" | ||
24 | #include "scatterwalk.h" | ||
25 | |||
26 | static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) | 25 | static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) |
27 | { | 26 | { |
28 | void *src = out ? buf : sgdata; | 27 | void *src = out ? buf : sgdata; |
@@ -106,6 +105,9 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | |||
106 | struct scatter_walk walk; | 105 | struct scatter_walk walk; |
107 | unsigned int offset = 0; | 106 | unsigned int offset = 0; |
108 | 107 | ||
108 | if (!nbytes) | ||
109 | return; | ||
110 | |||
109 | for (;;) { | 111 | for (;;) { |
110 | scatterwalk_start(&walk, sg); | 112 | scatterwalk_start(&walk, sg); |
111 | 113 | ||
@@ -113,7 +115,7 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | |||
113 | break; | 115 | break; |
114 | 116 | ||
115 | offset += sg->length; | 117 | offset += sg->length; |
116 | sg = sg_next(sg); | 118 | sg = scatterwalk_sg_next(sg); |
117 | } | 119 | } |
118 | 120 | ||
119 | scatterwalk_advance(&walk, start - offset); | 121 | scatterwalk_advance(&walk, start - offset); |