From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: work around bogus gcc warning in xfs_allocbt_init_cursor
Date: Tue, 21 Jun 2011 10:05:57 +1000 [thread overview]
Message-ID: <20110621000557.GG32466@dastard> (raw)
In-Reply-To: <20110617131214.GA2141@infradead.org>
On Fri, Jun 17, 2011 at 09:12:14AM -0400, Christoph Hellwig wrote:
> GCC 4.6 complains about an array subscript is above array bounds when
> using the btree index to index into the agf_levels array. The only
> two indices passed in are 0 and 1, and we have an assert insuring that.
>
> Replace the trick of using the array index directly with using constants
> in the already existing branch for assigning the XFS_BTREE_LASTREC_UPDATE
> flag.
Ugh.
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/xfs/xfs_alloc_btree.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_alloc_btree.c 2011-06-17 14:16:27.929065669 +0200
> +++ xfs/fs/xfs/xfs_alloc_btree.c 2011-06-17 14:17:22.145729599 +0200
> @@ -427,13 +427,16 @@ xfs_allocbt_init_cursor(
>
> cur->bc_tp = tp;
> cur->bc_mp = mp;
> - cur->bc_nlevels = be32_to_cpu(agf->agf_levels[btnum]);
> cur->bc_btnum = btnum;
> cur->bc_blocklog = mp->m_sb.sb_blocklog;
> -
> cur->bc_ops = &xfs_allocbt_ops;
> - if (btnum == XFS_BTNUM_CNT)
> +
> + if (btnum == XFS_BTNUM_CNT) {
> + cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]);
> cur->bc_flags = XFS_BTREE_LASTREC_UPDATE;
> + } else {
> + cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]);
> + }
>
> cur->bc_private.a.agbp = agbp;
> cur->bc_private.a.agno = agno;
Looks fine.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2011-06-21 0:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 13:12 [PATCH] xfs: work around bogus gcc warning in xfs_allocbt_init_cursor Christoph Hellwig
2011-06-21 0:05 ` Dave Chinner [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=20110621000557.GG32466@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.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