* [PATCH] block: sed-opal: "Never True" conditions
@ 2019-06-27 22:31 Revanth Rajashekar
2019-06-29 15:40 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Revanth Rajashekar @ 2019-06-27 22:31 UTC (permalink / raw)
To: linux-block; +Cc: Jonathan Derrick, Scott Bauer, Revanth Rajashekar
'who' an unsigned variable in stucture opal_session_info
can never be lesser than zero. Hence, the condition
"who < OPAL_ADMIN1" can never be true.
Signed-off-by: Revanth Rajashekar <revanth.rajashekar@intel.com>
---
block/sed-opal.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/block/sed-opal.c b/block/sed-opal.c
index a46e8d13e16d..c75935bb6c1d 100644
--- a/block/sed-opal.c
+++ b/block/sed-opal.c
@@ -2092,8 +2092,7 @@ static int opal_lock_unlock(struct opal_dev *dev,
{
int ret;
- if (lk_unlk->session.who < OPAL_ADMIN1 ||
- lk_unlk->session.who > OPAL_USER9)
+ if (lk_unlk->session.who > OPAL_USER9)
return -EINVAL;
mutex_lock(&dev->dev_lock);
@@ -2171,9 +2170,7 @@ static int opal_set_new_pw(struct opal_dev *dev, struct opal_new_pw *opal_pw)
};
int ret;
- if (opal_pw->session.who < OPAL_ADMIN1 ||
- opal_pw->session.who > OPAL_USER9 ||
- opal_pw->new_user_pw.who < OPAL_ADMIN1 ||
+ if (opal_pw->session.who > OPAL_USER9 ||
opal_pw->new_user_pw.who > OPAL_USER9)
return -EINVAL;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: sed-opal: "Never True" conditions
2019-06-27 22:31 [PATCH] block: sed-opal: "Never True" conditions Revanth Rajashekar
@ 2019-06-29 15:40 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-06-29 15:40 UTC (permalink / raw)
To: Revanth Rajashekar, linux-block; +Cc: Jonathan Derrick, Scott Bauer
On 6/27/19 4:31 PM, Revanth Rajashekar wrote:
> 'who' an unsigned variable in stucture opal_session_info
> can never be lesser than zero. Hence, the condition
> "who < OPAL_ADMIN1" can never be true.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-29 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 22:31 [PATCH] block: sed-opal: "Never True" conditions Revanth Rajashekar
2019-06-29 15:40 ` Jens Axboe
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).