block: sed-opal: "Never True" conditions
authorRevanth Rajashekar <revanth.rajashekar@intel.com>
Thu, 27 Jun 2019 22:31:09 +0000 (16:31 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 29 Jun 2019 15:40:31 +0000 (09:40 -0600)
'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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/sed-opal.c

index bb8ef7963d11a0ed807622199d10b14c3f4f6e5c..c54019c11e916d0ca66ec43b781dd5c269b6d280 100644 (file)
@@ -2114,8 +2114,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);
@@ -2193,9 +2192,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;