cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/2] gfs2: Require user to provide argument for FITRIM
Date: Tue, 16 Oct 2012 11:40:06 +0100	[thread overview]
Message-ID: <1350384006.2748.25.camel@menhir> (raw)
In-Reply-To: <1350380348-17062-1-git-send-email-lczerner@redhat.com>

Hi,

Thanks for fix up my mistakes :-) Both patches are now in the -nmw tree,

Steve.

On Tue, 2012-10-16 at 11:39 +0200, Lukas Czerner wrote:
> When the fstrim_range argument is not provided by user in FITRIM ioctl
> we should just return EFAULT and not promoting bad behaviour by filling
> the structure in kernel. Let the user deal with it.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> ---
>  fs/gfs2/rgrp.c |    8 ++------
>  1 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index 3cc402c..ef00006 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -1271,11 +1271,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
>  	if (!blk_queue_discard(q))
>  		return -EOPNOTSUPP;
>  
> -	if (argp == NULL) {
> -		r.start = 0;
> -		r.len = ULLONG_MAX;
> -		r.minlen = 0;
> -	} else if (copy_from_user(&r, argp, sizeof(r)))
> +	if (copy_from_user(&r, argp, sizeof(r)))
>  		return -EFAULT;
>  
>  	ret = gfs2_rindex_update(sdp);
> @@ -1324,7 +1320,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
>  
>  out:
>  	r.len = trimmed << 9;
> -	if (argp && copy_to_user(argp, &r, sizeof(r)))
> +	if (copy_to_user(argp, &r, sizeof(r)))
>  		return -EFAULT;
>  
>  	return ret;




           reply	other threads:[~2012-10-16 10:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1350380348-17062-1-git-send-email-lczerner@redhat.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350384006.2748.25.camel@menhir \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).