linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy.lists@gmail.com>
To: andros@netapp.com
Cc: trond.myklebust@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout
Date: Mon, 13 Jun 2011 16:32:50 -0400	[thread overview]
Message-ID: <4DF673F2.4020707@gmail.com> (raw)
In-Reply-To: <1307995906-4177-1-git-send-email-andros@netapp.com>

On 2011-06-13 16:11, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> cc:stable@kernel.org [2.6.39]
> ---
>  fs/nfs/nfs4filelayout.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 2cfeaeb..3a8bd92 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -551,13 +551,16 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
>  		__func__, nfl_util, fl->num_fh, fl->first_stripe_index,
>  		fl->pattern_offset);
>  
> -	if (!fl->num_fh)
> +	if (fl->num_fh < 0 || fl->num_fh >

num_fh is unsigned so checking for < 0 is not really needed.

Benny

> +	    max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
>  		goto out_err;
>  
> -	fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
> -			       gfp_flags);
> -	if (!fl->fh_array)
> -		goto out_err;
> +	if (fl->num_fh > 0) {
> +		fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
> +				       gfp_flags);
> +		if (!fl->fh_array)
> +			goto out_err;
> +	}
>  
>  	for (i = 0; i < fl->num_fh; i++) {
>  		/* Do we want to use a mempool here? */

      parent reply	other threads:[~2011-06-13 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 20:11 [PATCH Bakeathon 1/2] NFSv4.1: allow zero fh array in filelayout decode layout andros
2011-06-13 20:11 ` [PATCH Bakeathon 2/2] NFSv4.1: File layout only supports whole file layouts andros
2011-06-13 20:32 ` Benny Halevy [this message]

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=4DF673F2.4020707@gmail.com \
    --to=bhalevy.lists@gmail.com \
    --cc=andros@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.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).