Files
mirror_zfs/module/zfs
Ned Bass 37f000c5aa Fix gcc array subscript above bounds warning
In a debug build, certain GCC versions flag an array bounds warning in
the below code from dnode_sync.c

    } else {
            int i;
            ASSERT(dn->dn_next_nblkptr[txgoff] < dnp->dn_nblkptr);
            /* the blkptrs we are losing better be unallocated */
            for (i = dn->dn_next_nblkptr[txgoff];
                i < dnp->dn_nblkptr; i++)
                    ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[i]));

This usage is in fact safe, since the ASSERT ensures the index does
not exceed to maximum possible number of block pointers. However gcc
can't determine that the assignment 'i = dn->dn_next_nblkptr[txgoff];'
falls within the array bounds so it issues a warning.  To avoid this,
initialize i to zero to make gcc happy but skip the elements before
dn->dn_next_nblkptr[txgoff] in the loop body.  Since a dnode contains
at most 3 block pointers this overhead should be negligible.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #950
2013-01-07 11:21:52 -08:00
..
2012-10-12 10:03:03 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-10-29 08:57:45 -07:00
2010-08-26 14:24:34 -07:00
2010-08-31 13:41:58 -07:00
2012-10-08 10:19:05 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-09 12:24:51 -08:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-02 15:45:56 -07:00
2012-09-17 11:22:23 -07:00
2010-08-31 13:41:58 -07:00
2012-10-15 16:01:54 -07:00
2010-08-31 08:38:46 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2010-12-07 16:05:25 -08:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:59 -07:00
2010-08-31 13:41:58 -07:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:58 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-30 13:48:17 -08:00
2012-08-27 12:01:37 -07:00
2012-11-02 15:45:56 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-12-18 11:02:28 -08:00
2012-09-05 08:44:58 -07:00
2012-09-05 08:44:58 -07:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:58 -07:00
2012-02-09 16:37:48 -08:00
2012-12-05 13:41:30 -08:00
2011-03-02 11:44:34 -08:00
2012-12-20 09:56:28 -08:00
2010-08-31 13:41:50 -07:00
2012-09-17 11:06:58 -07:00
2012-12-10 09:44:45 -08:00
2011-05-04 10:02:37 -07:00
2010-09-17 16:24:15 -07:00