ceph: handle kmalloc() failure
PATCH 1/1 ceph: handle kmalloc() failure
Return ERR_PTR(-ENOMEM) if kmalloc() fails. We handle allocation failures the same way later in the function.
Signed-off-by Dan Carpenter <[email protected]>
fs/ceph/mds_client.c +2 -0
@@ -328,6 +328,8 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,struct ceph_mds_session *s; s =kzalloc (sizeof (*s),GFP_NOFS ); +if (!s) +return ERR_PTR (-ENOMEM ); s->s_mdsc = mdsc; s->s_mds = mds; s->s_state =CEPH_MDS_SESSION_NEW ;
Sage Weil
AppliedQuoted 10 lines · Dan Carpenter
Return
ERR_PTR(-ENOMEM)ifkmalloc()fails. We handle allocation failures the same way later in the function.Signed-off-by Dan Carpenter <[email protected]>fs/ceph/mds_client.c +0
-0
fs/ceph/mds_client.c static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, · line 335
Quoted 8 lines
fs/ceph/mds_client.c +2
-0@@ -328,6 +328,8 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,struct ceph_mds_session *s; s =kzalloc (sizeof (*s),GFP_NOFS ); +if (!s) +return ERR_PTR (-ENOMEM ); s->s_mdsc = mdsc; s->s_mds = mds; s->s_state =CEPH_MDS_SESSION_NEW ;
Applied, thanks!
sage