Print this page
3743 zfs needs a refcount audit
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa_errlog.c
          +++ new/usr/src/uts/common/fs/zfs/spa_errlog.c
↓ open down ↓ 175 lines elided ↑ open up ↑
 176  176  
 177  177                  if (*count == 0) {
 178  178                          zap_cursor_fini(&zc);
 179  179                          return (SET_ERROR(ENOMEM));
 180  180                  }
 181  181  
 182  182                  name_to_bookmark(za.za_name, &zb);
 183  183  
 184  184                  if (copyout(&zb, (char *)addr +
 185  185                      (*count - 1) * sizeof (zbookmark_t),
 186      -                    sizeof (zbookmark_t)) != 0)
      186 +                    sizeof (zbookmark_t)) != 0) {
      187 +                        zap_cursor_fini(&zc);
 187  188                          return (SET_ERROR(EFAULT));
      189 +                }
 188  190  
 189  191                  *count -= 1;
 190  192          }
 191  193  
 192  194          zap_cursor_fini(&zc);
 193  195  
 194  196          return (0);
 195  197  }
 196  198  
 197  199  static int
↓ open down ↓ 207 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX