diff options
author | Tom Rix <[email protected]> | 2021-04-19 09:37:14 +0200 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2021-04-20 08:59:04 -0600 |
commit | ce9d2b4f7bbeec818766f1e809816ba37b9aa4fa (patch) | |
tree | 5fb8b3864ef04b12755bea8fef620f5c5594948d /tools/perf/scripts/python/libxed.py | |
parent | c77bfa8f5dbd3f8bbb99a751bab00ebcc229a5c5 (diff) |
block/rnbd-clt: Improve find_or_create_sess() return check
clang static analysis reports this problem
rnbd-clt.c:1212:11: warning: Branch condition evaluates to a
garbage value
else if (!first)
^~~~~~
This is triggered in the find_and_get_or_create_sess() call
because the variable first is not initialized and the
earlier check is specifically for
if (sess == ERR_PTR(-ENOMEM))
This is false positive.
But the if-check can be reduced by initializing first to
false and then returning if the call to find_or_creat_sess()
does not set it to true. When it remains false, either
sess will be valid or not. The not case is caught by
find_and_get_or_create_sess()'s caller rnbd_clt_map_device()
sess = find_and_get_or_create_sess(...);
if (IS_ERR(sess))
return ERR_CAST(sess);
Since find_and_get_or_create_sess() initializes first to false
setting it in find_or_create_sess() is not needed.
Signed-off-by: Tom Rix <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Signed-off-by: Gioh Kim <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions