diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-20 14:22:02 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-09-06 13:56:52 -0400 |
commit | d37b1d9943d5138b9b2630b7b7082629a82a1386 (patch) | |
tree | bf904513456933cbd93e22ce0068e2a6e34802a5 | |
parent | b529d1b382f77ec6221f9c5fffb17939e92629e4 (diff) |
ceph: adjust 36 checks for NULL pointers
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written ...
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | fs/ceph/addr.c | 2 | ||||
-rw-r--r-- | fs/ceph/cache.c | 2 | ||||
-rw-r--r-- | fs/ceph/caps.c | 4 | ||||
-rw-r--r-- | fs/ceph/debugfs.c | 2 | ||||
-rw-r--r-- | fs/ceph/file.c | 2 | ||||
-rw-r--r-- | fs/ceph/inode.c | 6 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 22 | ||||
-rw-r--r-- | fs/ceph/mdsmap.c | 6 | ||||
-rw-r--r-- | fs/ceph/super.c | 18 | ||||
-rw-r--r-- | fs/ceph/xattr.c | 8 |
10 files changed, 36 insertions, 36 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 0b073b6a2616..d82036e19083 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -540,7 +540,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) | |||
540 | 540 | ||
541 | /* verify this is a writeable snap context */ | 541 | /* verify this is a writeable snap context */ |
542 | snapc = page_snap_context(page); | 542 | snapc = page_snap_context(page); |
543 | if (snapc == NULL) { | 543 | if (!snapc) { |
544 | dout("writepage %p page %p not dirty?\n", inode, page); | 544 | dout("writepage %p page %p not dirty?\n", inode, page); |
545 | return 0; | 545 | return 0; |
546 | } | 546 | } |
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index 337f88673ed9..c4bc20a9705a 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c | |||
@@ -240,7 +240,7 @@ void ceph_fscache_register_inode_cookie(struct inode *inode) | |||
240 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 240 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
241 | 241 | ||
242 | /* No caching for filesystem */ | 242 | /* No caching for filesystem */ |
243 | if (fsc->fscache == NULL) | 243 | if (!fsc->fscache) |
244 | return; | 244 | return; |
245 | 245 | ||
246 | /* Only cache for regular files that are read only */ | 246 | /* Only cache for regular files that are read only */ |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index f1c5691e8e2c..662ada467c32 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -611,7 +611,7 @@ void ceph_add_cap(struct inode *inode, | |||
611 | } | 611 | } |
612 | 612 | ||
613 | if (flags & CEPH_CAP_FLAG_AUTH) { | 613 | if (flags & CEPH_CAP_FLAG_AUTH) { |
614 | if (ci->i_auth_cap == NULL || | 614 | if (!ci->i_auth_cap || |
615 | ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0) { | 615 | ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0) { |
616 | ci->i_auth_cap = cap; | 616 | ci->i_auth_cap = cap; |
617 | cap->mds_wanted = wanted; | 617 | cap->mds_wanted = wanted; |
@@ -728,7 +728,7 @@ static void __touch_cap(struct ceph_cap *cap) | |||
728 | struct ceph_mds_session *s = cap->session; | 728 | struct ceph_mds_session *s = cap->session; |
729 | 729 | ||
730 | spin_lock(&s->s_cap_lock); | 730 | spin_lock(&s->s_cap_lock); |
731 | if (s->s_cap_iterator == NULL) { | 731 | if (!s->s_cap_iterator) { |
732 | dout("__touch_cap %p cap %p mds%d\n", &cap->ci->vfs_inode, cap, | 732 | dout("__touch_cap %p cap %p mds%d\n", &cap->ci->vfs_inode, cap, |
733 | s->s_mds); | 733 | s->s_mds); |
734 | list_move_tail(&cap->session_caps, &s->s_caps); | 734 | list_move_tail(&cap->session_caps, &s->s_caps); |
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 4e2d112c982f..d635496ea189 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -24,7 +24,7 @@ static int mdsmap_show(struct seq_file *s, void *p) | |||
24 | struct ceph_fs_client *fsc = s->private; | 24 | struct ceph_fs_client *fsc = s->private; |
25 | struct ceph_mdsmap *mdsmap; | 25 | struct ceph_mdsmap *mdsmap; |
26 | 26 | ||
27 | if (fsc->mdsc == NULL || fsc->mdsc->mdsmap == NULL) | 27 | if (!fsc->mdsc || !fsc->mdsc->mdsmap) |
28 | return 0; | 28 | return 0; |
29 | mdsmap = fsc->mdsc->mdsmap; | 29 | mdsmap = fsc->mdsc->mdsmap; |
30 | seq_printf(s, "epoch %d\n", mdsmap->m_epoch); | 30 | seq_printf(s, "epoch %d\n", mdsmap->m_epoch); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 9634eb79b041..65a6fa12c857 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -175,7 +175,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode) | |||
175 | dout("init_file %p %p 0%o (regular)\n", inode, file, | 175 | dout("init_file %p %p 0%o (regular)\n", inode, file, |
176 | inode->i_mode); | 176 | inode->i_mode); |
177 | cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL); | 177 | cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL); |
178 | if (cf == NULL) { | 178 | if (!cf) { |
179 | ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */ | 179 | ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */ |
180 | return -ENOMEM; | 180 | return -ENOMEM; |
181 | } | 181 | } |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 277c7cd7b1ab..a19fafdf87f8 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -52,7 +52,7 @@ struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino) | |||
52 | ino_t t = ceph_vino_to_ino(vino); | 52 | ino_t t = ceph_vino_to_ino(vino); |
53 | 53 | ||
54 | inode = iget5_locked(sb, t, ceph_ino_compare, ceph_set_ino_cb, &vino); | 54 | inode = iget5_locked(sb, t, ceph_ino_compare, ceph_set_ino_cb, &vino); |
55 | if (inode == NULL) | 55 | if (!inode) |
56 | return ERR_PTR(-ENOMEM); | 56 | return ERR_PTR(-ENOMEM); |
57 | if (inode->i_state & I_NEW) { | 57 | if (inode->i_state & I_NEW) { |
58 | dout("get_inode created new inode %p %llx.%llx ino %llx\n", | 58 | dout("get_inode created new inode %p %llx.%llx ino %llx\n", |
@@ -1173,7 +1173,7 @@ retry_lookup: | |||
1173 | dn = d_alloc(parent, &dname); | 1173 | dn = d_alloc(parent, &dname); |
1174 | dout("d_alloc %p '%.*s' = %p\n", parent, | 1174 | dout("d_alloc %p '%.*s' = %p\n", parent, |
1175 | dname.len, dname.name, dn); | 1175 | dname.len, dname.name, dn); |
1176 | if (dn == NULL) { | 1176 | if (!dn) { |
1177 | dput(parent); | 1177 | dput(parent); |
1178 | err = -ENOMEM; | 1178 | err = -ENOMEM; |
1179 | goto done; | 1179 | goto done; |
@@ -1562,7 +1562,7 @@ retry_lookup: | |||
1562 | dn = d_alloc(parent, &dname); | 1562 | dn = d_alloc(parent, &dname); |
1563 | dout("d_alloc %p '%.*s' = %p\n", parent, | 1563 | dout("d_alloc %p '%.*s' = %p\n", parent, |
1564 | dname.len, dname.name, dn); | 1564 | dname.len, dname.name, dn); |
1565 | if (dn == NULL) { | 1565 | if (!dn) { |
1566 | dout("d_alloc badness\n"); | 1566 | dout("d_alloc badness\n"); |
1567 | err = -ENOMEM; | 1567 | err = -ENOMEM; |
1568 | goto out; | 1568 | goto out; |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index e53437154cfe..9dd6b836ac9e 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -408,7 +408,7 @@ struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc, | |||
408 | { | 408 | { |
409 | struct ceph_mds_session *session; | 409 | struct ceph_mds_session *session; |
410 | 410 | ||
411 | if (mds >= mdsc->max_sessions || mdsc->sessions[mds] == NULL) | 411 | if (mds >= mdsc->max_sessions || !mdsc->sessions[mds]) |
412 | return NULL; | 412 | return NULL; |
413 | session = mdsc->sessions[mds]; | 413 | session = mdsc->sessions[mds]; |
414 | dout("lookup_mds_session %p %d\n", session, | 414 | dout("lookup_mds_session %p %d\n", session, |
@@ -483,7 +483,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, | |||
483 | 483 | ||
484 | dout("register_session realloc to %d\n", newmax); | 484 | dout("register_session realloc to %d\n", newmax); |
485 | sa = kcalloc(newmax, sizeof(void *), GFP_NOFS); | 485 | sa = kcalloc(newmax, sizeof(void *), GFP_NOFS); |
486 | if (sa == NULL) | 486 | if (!sa) |
487 | goto fail_realloc; | 487 | goto fail_realloc; |
488 | if (mdsc->sessions) { | 488 | if (mdsc->sessions) { |
489 | memcpy(sa, mdsc->sessions, | 489 | memcpy(sa, mdsc->sessions, |
@@ -893,7 +893,7 @@ static struct ceph_msg *create_session_open_msg(struct ceph_mds_client *mdsc, u6 | |||
893 | 893 | ||
894 | /* Calculate serialized length of metadata */ | 894 | /* Calculate serialized length of metadata */ |
895 | metadata_bytes = 4; /* map length */ | 895 | metadata_bytes = 4; /* map length */ |
896 | for (i = 0; metadata[i][0] != NULL; ++i) { | 896 | for (i = 0; metadata[i][0]; ++i) { |
897 | metadata_bytes += 8 + strlen(metadata[i][0]) + | 897 | metadata_bytes += 8 + strlen(metadata[i][0]) + |
898 | strlen(metadata[i][1]); | 898 | strlen(metadata[i][1]); |
899 | metadata_key_count++; | 899 | metadata_key_count++; |
@@ -926,7 +926,7 @@ static struct ceph_msg *create_session_open_msg(struct ceph_mds_client *mdsc, u6 | |||
926 | ceph_encode_32(&p, metadata_key_count); | 926 | ceph_encode_32(&p, metadata_key_count); |
927 | 927 | ||
928 | /* Two length-prefixed strings for each entry in the map */ | 928 | /* Two length-prefixed strings for each entry in the map */ |
929 | for (i = 0; metadata[i][0] != NULL; ++i) { | 929 | for (i = 0; metadata[i][0]; ++i) { |
930 | size_t const key_len = strlen(metadata[i][0]); | 930 | size_t const key_len = strlen(metadata[i][0]); |
931 | size_t const val_len = strlen(metadata[i][1]); | 931 | size_t const val_len = strlen(metadata[i][1]); |
932 | 932 | ||
@@ -1129,7 +1129,7 @@ static int iterate_session_caps(struct ceph_mds_session *session, | |||
1129 | 1129 | ||
1130 | spin_lock(&session->s_cap_lock); | 1130 | spin_lock(&session->s_cap_lock); |
1131 | p = p->next; | 1131 | p = p->next; |
1132 | if (cap->ci == NULL) { | 1132 | if (!cap->ci) { |
1133 | dout("iterate_session_caps finishing cap %p removal\n", | 1133 | dout("iterate_session_caps finishing cap %p removal\n", |
1134 | cap); | 1134 | cap); |
1135 | BUG_ON(cap->session != session); | 1135 | BUG_ON(cap->session != session); |
@@ -1755,7 +1755,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base, | |||
1755 | int len, pos; | 1755 | int len, pos; |
1756 | unsigned seq; | 1756 | unsigned seq; |
1757 | 1757 | ||
1758 | if (dentry == NULL) | 1758 | if (!dentry) |
1759 | return ERR_PTR(-EINVAL); | 1759 | return ERR_PTR(-EINVAL); |
1760 | 1760 | ||
1761 | retry: | 1761 | retry: |
@@ -1778,7 +1778,7 @@ retry: | |||
1778 | len--; /* no leading '/' */ | 1778 | len--; /* no leading '/' */ |
1779 | 1779 | ||
1780 | path = kmalloc(len+1, GFP_NOFS); | 1780 | path = kmalloc(len+1, GFP_NOFS); |
1781 | if (path == NULL) | 1781 | if (!path) |
1782 | return ERR_PTR(-ENOMEM); | 1782 | return ERR_PTR(-ENOMEM); |
1783 | pos = len; | 1783 | pos = len; |
1784 | path[pos] = 0; /* trailing null */ | 1784 | path[pos] = 0; /* trailing null */ |
@@ -3140,7 +3140,7 @@ static void check_new_map(struct ceph_mds_client *mdsc, | |||
3140 | newmap->m_epoch, oldmap->m_epoch); | 3140 | newmap->m_epoch, oldmap->m_epoch); |
3141 | 3141 | ||
3142 | for (i = 0; i < oldmap->m_num_mds && i < mdsc->max_sessions; i++) { | 3142 | for (i = 0; i < oldmap->m_num_mds && i < mdsc->max_sessions; i++) { |
3143 | if (mdsc->sessions[i] == NULL) | 3143 | if (!mdsc->sessions[i]) |
3144 | continue; | 3144 | continue; |
3145 | s = mdsc->sessions[i]; | 3145 | s = mdsc->sessions[i]; |
3146 | oldstate = ceph_mdsmap_get_state(oldmap, i); | 3146 | oldstate = ceph_mdsmap_get_state(oldmap, i); |
@@ -3287,7 +3287,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
3287 | mutex_lock(&session->s_mutex); | 3287 | mutex_lock(&session->s_mutex); |
3288 | session->s_seq++; | 3288 | session->s_seq++; |
3289 | 3289 | ||
3290 | if (inode == NULL) { | 3290 | if (!inode) { |
3291 | dout("handle_lease no inode %llx\n", vino.ino); | 3291 | dout("handle_lease no inode %llx\n", vino.ino); |
3292 | goto release; | 3292 | goto release; |
3293 | } | 3293 | } |
@@ -3445,7 +3445,7 @@ static void delayed_work(struct work_struct *work) | |||
3445 | 3445 | ||
3446 | for (i = 0; i < mdsc->max_sessions; i++) { | 3446 | for (i = 0; i < mdsc->max_sessions; i++) { |
3447 | struct ceph_mds_session *s = __ceph_lookup_mds_session(mdsc, i); | 3447 | struct ceph_mds_session *s = __ceph_lookup_mds_session(mdsc, i); |
3448 | if (s == NULL) | 3448 | if (!s) |
3449 | continue; | 3449 | continue; |
3450 | if (s->s_state == CEPH_MDS_SESSION_CLOSING) { | 3450 | if (s->s_state == CEPH_MDS_SESSION_CLOSING) { |
3451 | dout("resending session close request for mds%d\n", | 3451 | dout("resending session close request for mds%d\n", |
@@ -3497,7 +3497,7 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) | |||
3497 | fsc->mdsc = mdsc; | 3497 | fsc->mdsc = mdsc; |
3498 | mutex_init(&mdsc->mutex); | 3498 | mutex_init(&mdsc->mutex); |
3499 | mdsc->mdsmap = kzalloc(sizeof(*mdsc->mdsmap), GFP_NOFS); | 3499 | mdsc->mdsmap = kzalloc(sizeof(*mdsc->mdsmap), GFP_NOFS); |
3500 | if (mdsc->mdsmap == NULL) { | 3500 | if (!mdsc->mdsmap) { |
3501 | kfree(mdsc); | 3501 | kfree(mdsc); |
3502 | return -ENOMEM; | 3502 | return -ENOMEM; |
3503 | } | 3503 | } |
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index 1a748cf88535..33ced4c22732 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c | |||
@@ -112,7 +112,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
112 | u16 mdsmap_ev; | 112 | u16 mdsmap_ev; |
113 | 113 | ||
114 | m = kzalloc(sizeof(*m), GFP_NOFS); | 114 | m = kzalloc(sizeof(*m), GFP_NOFS); |
115 | if (m == NULL) | 115 | if (!m) |
116 | return ERR_PTR(-ENOMEM); | 116 | return ERR_PTR(-ENOMEM); |
117 | 117 | ||
118 | ceph_decode_need(p, end, 1 + 1, bad); | 118 | ceph_decode_need(p, end, 1 + 1, bad); |
@@ -138,7 +138,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
138 | m->m_num_mds = m->m_max_mds; | 138 | m->m_num_mds = m->m_max_mds; |
139 | 139 | ||
140 | m->m_info = kcalloc(m->m_num_mds, sizeof(*m->m_info), GFP_NOFS); | 140 | m->m_info = kcalloc(m->m_num_mds, sizeof(*m->m_info), GFP_NOFS); |
141 | if (m->m_info == NULL) | 141 | if (!m->m_info) |
142 | goto nomem; | 142 | goto nomem; |
143 | 143 | ||
144 | /* pick out active nodes from mds_info (state > 0) */ | 144 | /* pick out active nodes from mds_info (state > 0) */ |
@@ -232,7 +232,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
232 | if (num_export_targets) { | 232 | if (num_export_targets) { |
233 | info->export_targets = kcalloc(num_export_targets, | 233 | info->export_targets = kcalloc(num_export_targets, |
234 | sizeof(u32), GFP_NOFS); | 234 | sizeof(u32), GFP_NOFS); |
235 | if (info->export_targets == NULL) | 235 | if (!info->export_targets) |
236 | goto nomem; | 236 | goto nomem; |
237 | for (j = 0; j < num_export_targets; j++) | 237 | for (j = 0; j < num_export_targets; j++) |
238 | info->export_targets[j] = | 238 | info->export_targets[j] = |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 324d29ecbe0b..e4082afedcb1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -594,7 +594,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, | |||
594 | } | 594 | } |
595 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; | 595 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; |
596 | 596 | ||
597 | if (fsopt->mds_namespace == NULL) { | 597 | if (!fsopt->mds_namespace) { |
598 | ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, | 598 | ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, |
599 | 0, true); | 599 | 0, true); |
600 | } else { | 600 | } else { |
@@ -615,13 +615,13 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, | |||
615 | * to be processed in parallel, limit concurrency. | 615 | * to be processed in parallel, limit concurrency. |
616 | */ | 616 | */ |
617 | fsc->wb_wq = alloc_workqueue("ceph-writeback", 0, 1); | 617 | fsc->wb_wq = alloc_workqueue("ceph-writeback", 0, 1); |
618 | if (fsc->wb_wq == NULL) | 618 | if (!fsc->wb_wq) |
619 | goto fail_client; | 619 | goto fail_client; |
620 | fsc->pg_inv_wq = alloc_workqueue("ceph-pg-invalid", 0, 1); | 620 | fsc->pg_inv_wq = alloc_workqueue("ceph-pg-invalid", 0, 1); |
621 | if (fsc->pg_inv_wq == NULL) | 621 | if (!fsc->pg_inv_wq) |
622 | goto fail_wb_wq; | 622 | goto fail_wb_wq; |
623 | fsc->trunc_wq = alloc_workqueue("ceph-trunc", 0, 1); | 623 | fsc->trunc_wq = alloc_workqueue("ceph-trunc", 0, 1); |
624 | if (fsc->trunc_wq == NULL) | 624 | if (!fsc->trunc_wq) |
625 | goto fail_pg_inv_wq; | 625 | goto fail_pg_inv_wq; |
626 | 626 | ||
627 | /* set up mempools */ | 627 | /* set up mempools */ |
@@ -692,26 +692,26 @@ static int __init init_caches(void) | |||
692 | __alignof__(struct ceph_inode_info), | 692 | __alignof__(struct ceph_inode_info), |
693 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD| | 693 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD| |
694 | SLAB_ACCOUNT, ceph_inode_init_once); | 694 | SLAB_ACCOUNT, ceph_inode_init_once); |
695 | if (ceph_inode_cachep == NULL) | 695 | if (!ceph_inode_cachep) |
696 | return -ENOMEM; | 696 | return -ENOMEM; |
697 | 697 | ||
698 | ceph_cap_cachep = KMEM_CACHE(ceph_cap, | 698 | ceph_cap_cachep = KMEM_CACHE(ceph_cap, |
699 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); | 699 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); |
700 | if (ceph_cap_cachep == NULL) | 700 | if (!ceph_cap_cachep) |
701 | goto bad_cap; | 701 | goto bad_cap; |
702 | ceph_cap_flush_cachep = KMEM_CACHE(ceph_cap_flush, | 702 | ceph_cap_flush_cachep = KMEM_CACHE(ceph_cap_flush, |
703 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); | 703 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); |
704 | if (ceph_cap_flush_cachep == NULL) | 704 | if (!ceph_cap_flush_cachep) |
705 | goto bad_cap_flush; | 705 | goto bad_cap_flush; |
706 | 706 | ||
707 | ceph_dentry_cachep = KMEM_CACHE(ceph_dentry_info, | 707 | ceph_dentry_cachep = KMEM_CACHE(ceph_dentry_info, |
708 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); | 708 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); |
709 | if (ceph_dentry_cachep == NULL) | 709 | if (!ceph_dentry_cachep) |
710 | goto bad_dentry; | 710 | goto bad_dentry; |
711 | 711 | ||
712 | ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD); | 712 | ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD); |
713 | 713 | ||
714 | if (ceph_file_cachep == NULL) | 714 | if (!ceph_file_cachep) |
715 | goto bad_file; | 715 | goto bad_file; |
716 | 716 | ||
717 | if ((error = ceph_fscache_register())) | 717 | if ((error = ceph_fscache_register())) |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 11263f102e4c..3542b2c364cf 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -777,7 +777,7 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value, | |||
777 | spin_unlock(&ci->i_ceph_lock); | 777 | spin_unlock(&ci->i_ceph_lock); |
778 | 778 | ||
779 | /* security module gets xattr while filling trace */ | 779 | /* security module gets xattr while filling trace */ |
780 | if (current->journal_info != NULL) { | 780 | if (current->journal_info) { |
781 | pr_warn_ratelimited("sync getxattr %p " | 781 | pr_warn_ratelimited("sync getxattr %p " |
782 | "during filling trace\n", inode); | 782 | "during filling trace\n", inode); |
783 | return -EBUSY; | 783 | return -EBUSY; |
@@ -809,7 +809,7 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value, | |||
809 | 809 | ||
810 | memcpy(value, xattr->val, xattr->val_len); | 810 | memcpy(value, xattr->val, xattr->val_len); |
811 | 811 | ||
812 | if (current->journal_info != NULL && | 812 | if (current->journal_info && |
813 | !strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) | 813 | !strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) |
814 | ci->i_ceph_flags |= CEPH_I_SEC_INITED; | 814 | ci->i_ceph_flags |= CEPH_I_SEC_INITED; |
815 | out: | 815 | out: |
@@ -1058,7 +1058,7 @@ do_sync_unlocked: | |||
1058 | up_read(&mdsc->snap_rwsem); | 1058 | up_read(&mdsc->snap_rwsem); |
1059 | 1059 | ||
1060 | /* security module set xattr while filling trace */ | 1060 | /* security module set xattr while filling trace */ |
1061 | if (current->journal_info != NULL) { | 1061 | if (current->journal_info) { |
1062 | pr_warn_ratelimited("sync setxattr %p " | 1062 | pr_warn_ratelimited("sync setxattr %p " |
1063 | "during filling trace\n", inode); | 1063 | "during filling trace\n", inode); |
1064 | err = -EBUSY; | 1064 | err = -EBUSY; |
@@ -1108,7 +1108,7 @@ bool ceph_security_xattr_deadlock(struct inode *in) | |||
1108 | { | 1108 | { |
1109 | struct ceph_inode_info *ci; | 1109 | struct ceph_inode_info *ci; |
1110 | bool ret; | 1110 | bool ret; |
1111 | if (in->i_security == NULL) | 1111 | if (!in->i_security) |
1112 | return false; | 1112 | return false; |
1113 | ci = ceph_inode(in); | 1113 | ci = ceph_inode(in); |
1114 | spin_lock(&ci->i_ceph_lock); | 1114 | spin_lock(&ci->i_ceph_lock); |