* [patch] ceph: handle kmalloc() failure
@ 2010-03-20 12:30 Dan Carpenter
2010-03-21 3:59 ` [ceph-devel] " Sage Weil
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-20 12:30 UTC (permalink / raw)
To: Sage Weil; +Cc: Yehuda Sadeh, ceph-devel, linux-kernel, kernel-janitors
Return ERR_PTR(-ENOMEM) if kmalloc() fails. We handle allocation
failures the same way later in the function.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index a260010..655b005 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [ceph-devel] [patch] ceph: handle kmalloc() failure
2010-03-20 12:30 [patch] ceph: handle kmalloc() failure Dan Carpenter
@ 2010-03-21 3:59 ` Sage Weil
0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2010-03-21 3:59 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Yehuda Sadeh, ceph-devel, kernel-janitors, linux-kernel
On Sat, 20 Mar 2010, Dan Carpenter wrote:
> Return ERR_PTR(-ENOMEM) if kmalloc() fails. We handle allocation
> failures the same way later in the function.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index a260010..655b005 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-21 3:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-20 12:30 [patch] ceph: handle kmalloc() failure Dan Carpenter
2010-03-21 3:59 ` [ceph-devel] " Sage Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox