Commit c2091026 authored by David Disseldorp's avatar David Disseldorp Committed by Nicholas Bellinger

target/configfs: handle match_int() errors

As a follow up to ce31c1b0 - there are
still a few LIO match_int() calls that don't check the return value.
Propagate errors rather than using the potentially uninitialised result.
Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9105bfc0
...@@ -1658,22 +1658,32 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( ...@@ -1658,22 +1658,32 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
* PR APTPL Metadata for Reservation * PR APTPL Metadata for Reservation
*/ */
case Opt_res_holder: case Opt_res_holder:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
res_holder = arg; res_holder = arg;
break; break;
case Opt_res_type: case Opt_res_type:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
type = (u8)arg; type = (u8)arg;
break; break;
case Opt_res_scope: case Opt_res_scope:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
break; break;
case Opt_res_all_tg_pt: case Opt_res_all_tg_pt:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
all_tg_pt = (int)arg; all_tg_pt = (int)arg;
break; break;
case Opt_mapped_lun: case Opt_mapped_lun:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
mapped_lun = (u64)arg; mapped_lun = (u64)arg;
break; break;
/* /*
...@@ -1701,14 +1711,20 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( ...@@ -1701,14 +1711,20 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
} }
break; break;
case Opt_tpgt: case Opt_tpgt:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
tpgt = (u16)arg; tpgt = (u16)arg;
break; break;
case Opt_port_rtpi: case Opt_port_rtpi:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
break; break;
case Opt_target_lun: case Opt_target_lun:
match_int(args, &arg); ret = match_int(args, &arg);
if (ret)
goto out;
target_lun = (u64)arg; target_lun = (u64)arg;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment