public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* bug report: ceph: && vs ||
@ 2010-03-20 12:39 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:39 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel, linux-kernel



  1772          /* correct session? */
  1773          if (!req->r_session && req->r_session != session) {

	Is this supposed to || here?  We know "session" is non-NULL at
	the point because we already dereferenced it.  If "req->r_session"
	is null then the second condition is always true.

	Also we dereference "req->r_session" later on without checking.

  1774                  pr_err("mdsc_handle_reply got %llu on session mds%d"
  1775                         " not mds%d\n", tid, session->s_mds,
  1776                         req->r_session ? req->r_session->s_mds : -1);
  1777                  mutex_unlock(&mdsc->mutex);
  1778                  goto out;
  1779          }
  1780

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ceph-devel] bug report: ceph: && vs ||
  2010-03-20 12:39 bug report: ceph: && vs || 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: ceph-devel, linux-kernel

On Sat, 20 Mar 2010, Dan Carpenter wrote:
> 
> 
>   1772          /* correct session? */
>   1773          if (!req->r_session && req->r_session != session) {
> 
> 	Is this supposed to || here?  We know "session" is non-NULL at
> 	the point because we already dereferenced it.  If "req->r_session"
> 	is null then the second condition is always true.
> 
> 	Also we dereference "req->r_session" later on without checking.

Yeah, that check is clearly wrong.  A

	if (req->r_session != session) {

is sufficient because the passed session is always non-NULL.  Applied a 
fix.

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:39 bug report: ceph: && vs || 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