Skip to content

Commit 9b1ebce

Browse files
Su Huiaxboe
authored andcommitted
block: sed-opal: avoid possible wrong address reference in read_sed_opal_key()
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: 3bfeb61 ("block: sed-opal: keyring support for SED keys") Signed-off-by: Su Hui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 27d0242 commit 9b1ebce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/sed-opal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static int read_sed_opal_key(const char *key_name, u_char *buffer, int buflen)
314314
&key_type_user, key_name, true);
315315

316316
if (IS_ERR(kref))
317-
ret = PTR_ERR(kref);
317+
return PTR_ERR(kref);
318318

319319
key = key_ref_to_ptr(kref);
320320
down_read(&key->sem);

0 commit comments

Comments
 (0)