All of lore.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; 3+ 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] 3+ messages in thread

* Re: 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; 3+ 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

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

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

* Re: [ceph-devel] bug report: ceph: && vs ||
@ 2010-03-21  3:59   ` Sage Weil
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2010-03-21  3:59 UTC | newest]

Thread overview: 3+ 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 ` Sage Weil
2010-03-21  3:59   ` [ceph-devel] " 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.