diff options
author | Eric Biggers <ebiggers@google.com> | 2019-01-10 23:18:01 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-01-18 13:43:43 +0300 |
commit | 7c39edfb040078e1ab90e5c546cfeba8ec159bbd (patch) | |
tree | ea4b76916ddcb6d17696758a7312144aeb809764 /crypto/af_alg.c | |
parent | 466e0759269d31485074126700574230bfff3b1c (diff) | |
download | linux-7c39edfb040078e1ab90e5c546cfeba8ec159bbd.tar.xz |
crypto: af_alg - use list_for_each_entry() in af_alg_count_tsgl()
af_alg_count_tsgl() iterates through a list without modifying it, so use
list_for_each_entry() rather than list_for_each_entry_safe(). Also make
the pointers 'const' to make it clearer that nothing is modified.
No actual change in behavior.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r-- | crypto/af_alg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index ccae4a7ada8a..1dd573a44127 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -530,17 +530,17 @@ static int af_alg_alloc_tsgl(struct sock *sk) */ unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offset) { - struct alg_sock *ask = alg_sk(sk); - struct af_alg_ctx *ctx = ask->private; - struct af_alg_tsgl *sgl, *tmp; + const struct alg_sock *ask = alg_sk(sk); + const struct af_alg_ctx *ctx = ask->private; + const struct af_alg_tsgl *sgl; unsigned int i; unsigned int sgl_count = 0; if (!bytes) return 0; - list_for_each_entry_safe(sgl, tmp, &ctx->tsgl_list, list) { - struct scatterlist *sg = sgl->sg; + list_for_each_entry(sgl, &ctx->tsgl_list, list) { + const struct scatterlist *sg = sgl->sg; for (i = 0; i < sgl->cur; i++) { size_t bytes_count; |