Linux-FSCrypt Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] fs-verity: use u64_to_user_ptr()
@ 2019-12-31 17:54 Eric Biggers
  2020-01-14 21:33 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2019-12-31 17:54 UTC (permalink / raw)
  To: linux-fscrypt

From: Eric Biggers <ebiggers@google.com>

<linux/kernel.h> already provides a macro u64_to_user_ptr().
Use it instead of open-coding the two casts.

No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/verity/enable.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/verity/enable.c b/fs/verity/enable.c
index 1645d6326e32..520db12e2945 100644
--- a/fs/verity/enable.c
+++ b/fs/verity/enable.c
@@ -216,8 +216,7 @@ static int enable_verity(struct file *filp,
 
 	/* Get the salt if the user provided one */
 	if (arg->salt_size &&
-	    copy_from_user(desc->salt,
-			   (const u8 __user *)(uintptr_t)arg->salt_ptr,
+	    copy_from_user(desc->salt, u64_to_user_ptr(arg->salt_ptr),
 			   arg->salt_size)) {
 		err = -EFAULT;
 		goto out;
@@ -226,8 +225,7 @@ static int enable_verity(struct file *filp,
 
 	/* Get the signature if the user provided one */
 	if (arg->sig_size &&
-	    copy_from_user(desc->signature,
-			   (const u8 __user *)(uintptr_t)arg->sig_ptr,
+	    copy_from_user(desc->signature, u64_to_user_ptr(arg->sig_ptr),
 			   arg->sig_size)) {
 		err = -EFAULT;
 		goto out;
-- 
2.24.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs-verity: use u64_to_user_ptr()
  2019-12-31 17:54 [PATCH] fs-verity: use u64_to_user_ptr() Eric Biggers
@ 2020-01-14 21:33 ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2020-01-14 21:33 UTC (permalink / raw)
  To: linux-fscrypt

On Tue, Dec 31, 2019 at 11:54:08AM -0600, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> <linux/kernel.h> already provides a macro u64_to_user_ptr().
> Use it instead of open-coding the two casts.
> 
> No change in behavior.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  fs/verity/enable.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/verity/enable.c b/fs/verity/enable.c
> index 1645d6326e32..520db12e2945 100644
> --- a/fs/verity/enable.c
> +++ b/fs/verity/enable.c
> @@ -216,8 +216,7 @@ static int enable_verity(struct file *filp,
>  
>  	/* Get the salt if the user provided one */
>  	if (arg->salt_size &&
> -	    copy_from_user(desc->salt,
> -			   (const u8 __user *)(uintptr_t)arg->salt_ptr,
> +	    copy_from_user(desc->salt, u64_to_user_ptr(arg->salt_ptr),
>  			   arg->salt_size)) {
>  		err = -EFAULT;
>  		goto out;
> @@ -226,8 +225,7 @@ static int enable_verity(struct file *filp,
>  
>  	/* Get the signature if the user provided one */
>  	if (arg->sig_size &&
> -	    copy_from_user(desc->signature,
> -			   (const u8 __user *)(uintptr_t)arg->sig_ptr,
> +	    copy_from_user(desc->signature, u64_to_user_ptr(arg->sig_ptr),
>  			   arg->sig_size)) {
>  		err = -EFAULT;
>  		goto out;

Applied to fscrypt.git#fsverity for 5.6.

- Eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-31 17:54 [PATCH] fs-verity: use u64_to_user_ptr() Eric Biggers
2020-01-14 21:33 ` Eric Biggers

Linux-FSCrypt Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fscrypt/0 linux-fscrypt/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fscrypt linux-fscrypt/ https://lore.kernel.org/linux-fscrypt \
		linux-fscrypt@vger.kernel.org
	public-inbox-index linux-fscrypt

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fscrypt


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git