* bug report: potential null dereference
@ 2010-05-25 9:42 Dan Carpenter
2010-05-25 16:28 ` Sage Weil
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-05-25 9:42 UTC (permalink / raw)
To: Sage Weil; +Cc: ceph-devel
Hello,
This is a Smatch thing.
fs/ceph/auth.c +220 ceph_handle_auth_reply(55) error: potential null derefence 'ac->ops'.
211 /* set up (new) protocol handler? */
212 if (ac->protocol && ac->protocol != protocol) {
213 ac->ops->destroy(ac);
214 ac->protocol = 0;
215 ac->ops = NULL;
^^^^^^^^^^^^^^^
We set ac->ops to NULL here.
216 }
217 if (ac->protocol != protocol) {
218 ret = ceph_auth_init_protocol(ac, protocol);
219 if (ret) {
220 pr_err("error %d on auth method %s init\n",
221 ret, ac->ops->name);
^^^^^^^^^^^^^^
We dereference it here. ceph_auth_init_protocol() can fail
before re-assigning it.
222 goto out;
223 }
224 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: bug report: potential null dereference
2010-05-25 9:42 bug report: potential null dereference Dan Carpenter
@ 2010-05-25 16:28 ` Sage Weil
0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2010-05-25 16:28 UTC (permalink / raw)
To: Dan Carpenter; +Cc: ceph-devel
On Tue, 25 May 2010, Dan Carpenter wrote:
> Hello,
>
> This is a Smatch thing.
>
> fs/ceph/auth.c +220 ceph_handle_auth_reply(55) error: potential null derefence 'ac->ops'.
> 211 /* set up (new) protocol handler? */
> 212 if (ac->protocol && ac->protocol != protocol) {
> 213 ac->ops->destroy(ac);
> 214 ac->protocol = 0;
> 215 ac->ops = NULL;
> ^^^^^^^^^^^^^^^
> We set ac->ops to NULL here.
>
> 216 }
> 217 if (ac->protocol != protocol) {
> 218 ret = ceph_auth_init_protocol(ac, protocol);
> 219 if (ret) {
> 220 pr_err("error %d on auth method %s init\n",
> 221 ret, ac->ops->name);
> ^^^^^^^^^^^^^^
> We dereference it here. ceph_auth_init_protocol() can fail
> before re-assigning it.
>
> 222 goto out;
> 223 }
> 224 }
Thanks, I've queued up a fix.
sage
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-25 16:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 9:42 bug report: potential null dereference Dan Carpenter
2010-05-25 16:28 ` Sage Weil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.