summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorSu Hui <suhui@nfschina.com>2024-06-11 10:37:00 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-21 15:40:24 +0300
commita6075ad4ca526d627f72514a82157b560118cbc9 (patch)
tree26d08a099b934911fbb4ba03e7ed06aed32e6241 /block
parentd1ce0826a4fe55986e6e7747c1d6fbac2e8edaec (diff)
downloadlinux-a6075ad4ca526d627f72514a82157b560118cbc9.tar.xz
block: sed-opal: avoid possible wrong address reference in read_sed_opal_key()
[ Upstream commit 9b1ebce6a1fded90d4a1c6c57dc6262dac4c4c14 ] Clang static checker (scan-build) warning: block/sed-opal.c:line 317, column 3 Value stored to 'ret' is never read. Fix this problem by returning the error code when keyring_search() failed. Otherwise, 'key' will have a wrong value when 'kerf' stores the error code. Fixes: 3bfeb6125664 ("block: sed-opal: keyring support for SED keys") Signed-off-by: Su Hui <suhui@nfschina.com> Link: https://lore.kernel.org/r/20240611073659.429582-1-suhui@nfschina.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/sed-opal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/sed-opal.c b/block/sed-opal.c
index 14fe0fef811c..598fd3e7fcc8 100644
--- a/block/sed-opal.c
+++ b/block/sed-opal.c
@@ -314,7 +314,7 @@ static int read_sed_opal_key(const char *key_name, u_char *buffer, int buflen)
&key_type_user, key_name, true);
if (IS_ERR(kref))
- ret = PTR_ERR(kref);
+ return PTR_ERR(kref);
key = key_ref_to_ptr(kref);
down_read(&key->sem);