Fix some potential NULL pointer deferences that Coverity pointed out,
and remove a trivial dead integer check.
Coverity-id:
1375789,
1375790,
1375791,
1375792
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
refc_rec = pop_slab_cursor(refc_cur);
lptr = &btree_curs->level[0];
- for (i = 0; i < lptr->num_blocks; i++) {
+ for (i = 0; i < lptr->num_blocks && refc_rec != NULL; i++) {
/*
* block initialization, lay in block header
*/
mark_inode_rl(mp, stack_top);
/* Set nbno to the bno of the next refcount change */
- if (n < slab_count(rmaps))
+ if (n < slab_count(rmaps) && array_cur)
nbno = array_cur->rm_startblock;
else
nbno = NULLAGBLOCK;
#define foreach_bag_ptr_reverse(bag, idx, ptr) \
for ((idx) = bag_count(bag) - 1, (ptr) = bag_item((bag), (idx)); \
- (idx) >= 0 && (ptr) != NULL; \
+ (ptr) != NULL; \
(idx)--, (ptr) = bag_item((bag), (idx)))
#endif /* SLAB_H_ */