Message ID | 20161110200438.GA22854@mwanda (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Nov 10, 2016 at 11:04:38PM +0300, Dan Carpenter wrote: > 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. Its is. And while we're at it the macro should really be doing a = instead of |=. And we really should stop using it, at least in the block core even ASAP. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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) {
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> -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html