linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
       [not found] <1339018901-28439-1-git-send-email-Julia.Lawall@lip6.fr>
@ 2012-06-06 21:41 ` Julia Lawall
  2012-06-07 14:24   ` Jeff Moyer
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Alexander Viro
  Cc: kernel-janitors, linux-fsdevel, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

READ is 0, so the result of the bit-and operation is 0.  Rewrite with == as
done elsewhere in the same file.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 fs/direct-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 0c85fae..1faf4cb 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1258,7 +1258,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 	 */
 	BUG_ON(retval == -EIOCBQUEUED);
 	if (dio->is_async && retval == 0 && dio->result &&
-	    ((rw & READ) || (dio->result == sdio.size)))
+	    ((rw == READ) || (dio->result == sdio.size)))
 		retval = -EIOCBQUEUED;
 
 	if (retval != -EIOCBQUEUED)

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

* Re: [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
  2012-06-06 21:41 ` [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation Julia Lawall
@ 2012-06-07 14:24   ` Jeff Moyer
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Moyer @ 2012-06-07 14:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Alexander Viro, kernel-janitors, linux-fsdevel, linux-kernel, joe,
	Julia Lawall

Julia Lawall <Julia.Lawall@lip6.fr> writes:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> READ is 0, so the result of the bit-and operation is 0.  Rewrite with == as
> done elsewhere in the same file.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Interesting catch, that one.  Yeah, we don't expect any readahead I/O to
be done via O_DIRECT.  The test for rw == READ all over that file seems
fine to me, given that.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

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

end of thread, other threads:[~2012-06-07 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1339018901-28439-1-git-send-email-Julia.Lawall@lip6.fr>
2012-06-06 21:41 ` [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation Julia Lawall
2012-06-07 14:24   ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).