From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>
Cc: Mike Christie <mchristi@redhat.com>,
Shaun Tancheff <shaun.tancheff@seagate.com>,
Hannes Reinecke <hare@suse.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
Bart Van Assche <bart.vanassche@sandisk.com>,
Ming Lei <ming.lei@canonical.com>,
linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] block: precedence bug in bio_set_op_attrs() macro
Date: Thu, 10 Nov 2016 23:04:38 +0300 [thread overview]
Message-ID: <20161110200438.GA22854@mwanda> (raw)
This code causes a problem for flush_epd_write_bio() because | has
higher precedence than ?: so it basically turns into:
((bio)->bi_opf |= REQ_SYNC;
Which is wrong.
Fixes: ef295ecf090d ("block: better op and flags encoding")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 562ac46..67fae32 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -208,7 +208,7 @@ enum req_flag_bits {
/* obsolete, don't use in new code */
#define bio_set_op_attrs(bio, op, op_flags) \
- ((bio)->bi_opf |= (op | op_flags))
+ ((bio)->bi_opf |= ((op) | (op_flags)))
static inline bool op_is_write(unsigned int op)
{
next reply other threads:[~2016-11-10 20:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 20:04 Dan Carpenter [this message]
2016-11-10 20:07 ` [patch] block: precedence bug in bio_set_op_attrs() macro Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161110200438.GA22854@mwanda \
--to=dan.carpenter@oracle.com \
--cc=axboe@fb.com \
--cc=bart.vanassche@sandisk.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=mchristi@redhat.com \
--cc=ming.lei@canonical.com \
--cc=shaun.tancheff@seagate.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).