From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Max Gurtovoy <maxg@mellanox.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-block@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 1/1] block: add default clause for unsupported T10_PI types
Date: Sun, 22 Sep 2019 13:31:09 -0400 [thread overview]
Message-ID: <yq1o8zc5jc2.fsf@oracle.com> (raw)
In-Reply-To: <ddd909c8-1309-5830-0669-371d2ae839fc@kernel.dk> (Jens Axboe's message of "Sun, 22 Sep 2019 10:25:14 -0600")
Jens,
> It's effectively the same thing, I really don't think we need (or should
> have) a BUG/BUG_ON for this condition. Just return an error?
> Just include a T10_PI_TYPE0_PROTECTION case in the switch, have it log
> and return an error. Add a comment on how it's impossible, if need be.
> I don't think it has to be more complicated than that.
The additional case statement is inside an iterator loop which would
bomb for Type 0 since there is no protection buffer to iterate
over. We'd presumably never reach that default: case before
dereferencing something bad.
t10_pi_verify() is a static function exclusively called by helpers that
pass in either 1 or 3 as argument. It seems kind of silly that we have
to jump through hoops to silence a compiler warning for this. I would
prefer a BUILD_BUG_ON(type == T10_PI_TYPE0_PROTECTION) at the top of the
function but that does not satisfy the -Wswitch logic either.
Anyway. Enough energy wasted on this. I'm OK with either the default:
case or Max' if statement approach. My objection is purely
wrt. introducing semantically incorrect and/or unreachable code to
silence compiler warnings. Seems backwards.
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2019-09-22 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-21 22:00 [PATCH 1/1] block: add default clause for unsupported T10_PI types Max Gurtovoy
2019-09-21 22:12 ` Jens Axboe
2019-09-21 22:54 ` Martin K. Petersen
2019-09-21 23:29 ` Jens Axboe
2019-09-22 9:38 ` Max Gurtovoy
2019-09-22 16:25 ` Jens Axboe
2019-09-22 17:31 ` Martin K. Petersen [this message]
2019-09-22 21:21 ` Max Gurtovoy
2019-09-23 14:05 ` Jens Axboe
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=yq1o8zc5jc2.fsf@oracle.com \
--to=martin.petersen@oracle.com \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=maxg@mellanox.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).