On 2011-06-13 16:11, andros@xxxxxxxxxx wrote: > From: Andy Adamson <andros@xxxxxxxxxx> > > Signed-off-by: Andy Adamson <andros@xxxxxxxxxx> > cc:stable@xxxxxxxxxx [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? */ -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html