From: Revanth Rajashekar Date: Thu, 27 Jun 2019 22:31:09 +0000 (-0600) Subject: block: sed-opal: "Never True" conditions X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=15ddffcb341392ba56a28a0ff5d19d8f8cde1b80;p=openwrt%2Fstaging%2Fblogic.git block: sed-opal: "Never True" conditions '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 Signed-off-by: Jens Axboe --- diff --git a/block/sed-opal.c b/block/sed-opal.c index bb8ef7963d11..c54019c11e91 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c @@ -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;