Re: [v2 PATCH 1/3] crypto: scatterwalk - Change scatterwalk_next calling convention

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

 



On Fri, Mar 07, 2025 at 11:36:16AM +0800, Herbert Xu wrote:
> diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
> index 11065978d360..8f1dfb758ced 100644
> --- a/include/crypto/algapi.h
> +++ b/include/crypto/algapi.h
> @@ -54,6 +54,7 @@ struct rtattr;
>  struct scatterlist;
>  struct seq_file;
>  struct sk_buff;
> +union crypto_no_such_thing;
>  
>  struct crypto_type {
>  	unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
> @@ -122,6 +123,12 @@ struct crypto_queue {
>  struct scatter_walk {
>  	struct scatterlist *sg;
>  	unsigned int offset;
> +	union {
> +		void *const addr;
> +
> +		/* Private API field, do not touch. */
> +		union crypto_no_such_thing *maddr;
> +	};
>  };

This is okay (it makes it a bit easier to accidentally use addr after it was
unmapped, but it's probably worth the simplification in code), but I think using
'void *__addr' would be more consistent with other places in the kernel that use
a similar trick to have something both const and non-const.  For example
struct inode in include/linux/fs.h has i_nlink and __i_nlink.

- Eric




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