Commit 7c39edfb authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

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: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 466e0759
...@@ -530,17 +530,17 @@ static int af_alg_alloc_tsgl(struct sock *sk) ...@@ -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) unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offset)
{ {
struct alg_sock *ask = alg_sk(sk); const struct alg_sock *ask = alg_sk(sk);
struct af_alg_ctx *ctx = ask->private; const struct af_alg_ctx *ctx = ask->private;
struct af_alg_tsgl *sgl, *tmp; const struct af_alg_tsgl *sgl;
unsigned int i; unsigned int i;
unsigned int sgl_count = 0; unsigned int sgl_count = 0;
if (!bytes) if (!bytes)
return 0; return 0;
list_for_each_entry_safe(sgl, tmp, &ctx->tsgl_list, list) { list_for_each_entry(sgl, &ctx->tsgl_list, list) {
struct scatterlist *sg = sgl->sg; const struct scatterlist *sg = sgl->sg;
for (i = 0; i < sgl->cur; i++) { for (i = 0; i < sgl->cur; i++) {
size_t bytes_count; size_t bytes_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment