Re: [PATCH] crypto: scatterwalk - Change scatterwalk_next calling convention

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 06, 2025 at 10:52:48AM +0800, Herbert Xu wrote:
> +static inline unsigned int scatterwalk_next(struct scatter_walk *walk,
> +					    unsigned int total)
>  {
> -	*nbytes_ret = scatterwalk_clamp(walk, total);
> -	return scatterwalk_map(walk);
> +	total = scatterwalk_clamp(walk, total);
> +	walk->addr = scatterwalk_map(walk);
> +	return total;
>  }

Maybe do:

    unsigned int nbytes = scatterwalk_clamp(walk, total);

    walk->addr = scatterwalk_map(walk);
    return nbytes;

Otherwise 'total' is being reused for something that is not the total length,
which might be confusing.

> @@ -149,32 +150,30 @@ static inline void scatterwalk_advance(struct scatter_walk *walk,
>  /**
>   * scatterwalk_done_src() - Finish one step of a walk of source scatterlist
>   * @walk: the scatter_walk
> - * @vaddr: the address returned by scatterwalk_next()
>   * @nbytes: the number of bytes processed this step, less than or equal to the
>   *	    number of bytes that scatterwalk_next() returned.
>   *
>   * Use this if the @vaddr was not written to, i.e. it is source data.
>   */

The comment above still mentions @vaddr.

>  /**
>   * scatterwalk_done_dst() - Finish one step of a walk of destination scatterlist
>   * @walk: the scatter_walk
> - * @vaddr: the address returned by scatterwalk_next()
>   * @nbytes: the number of bytes processed this step, less than or equal to the
>   *	    number of bytes that scatterwalk_next() returned.
>   *
>   * Use this if the @vaddr may have been written to, i.e. it is destination data.
>   */

The comment above still mentions @vaddr.

- Eric




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux