btrfs: check NULL or not

Should check if functions returns NULL or not.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>

authored by Tsutomu Itoh and committed by Chris Mason 91ca338d ff175d57

+16
+6
fs/btrfs/ctree.c
··· 2516 2516 btrfs_assert_tree_locked(path->nodes[1]); 2517 2517 2518 2518 right = read_node_slot(root, upper, slot + 1); 2519 + if (right == NULL) 2520 + return 1; 2521 + 2519 2522 btrfs_tree_lock(right); 2520 2523 btrfs_set_lock_blocking(right); 2521 2524 ··· 2769 2766 btrfs_assert_tree_locked(path->nodes[1]); 2770 2767 2771 2768 left = read_node_slot(root, path->nodes[1], slot - 1); 2769 + if (left == NULL) 2770 + return 1; 2771 + 2772 2772 btrfs_tree_lock(left); 2773 2773 btrfs_set_lock_blocking(left); 2774 2774
+8
fs/btrfs/disk-io.c
··· 353 353 WARN_ON(len == 0); 354 354 355 355 eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); 356 + if (eb == NULL) { 357 + WARN_ON(1); 358 + goto out; 359 + } 356 360 ret = btree_read_extent_buffer_pages(root, eb, start + PAGE_CACHE_SIZE, 357 361 btrfs_header_generation(eb)); 358 362 BUG_ON(ret); ··· 431 427 WARN_ON(len == 0); 432 428 433 429 eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); 430 + if (eb == NULL) { 431 + ret = -EIO; 432 + goto out; 433 + } 434 434 435 435 found_start = btrfs_header_bytenr(eb); 436 436 if (found_start != start) {
+2
fs/btrfs/extent_io.c
··· 3075 3075 #endif 3076 3076 3077 3077 eb = kmem_cache_zalloc(extent_buffer_cache, mask); 3078 + if (eb == NULL) 3079 + return NULL; 3078 3080 eb->start = start; 3079 3081 eb->len = len; 3080 3082 spin_lock_init(&eb->lock);