Skip to content

Commit

Permalink
target/configfs: handle match_int() errors
Browse files Browse the repository at this point in the history
As a follow up to ce31c1b - 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: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
David Disseldorp authored and Nicholas Bellinger committed Jul 24, 2015
1 parent 9105bfc commit c209102
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions drivers/target/target_core_configfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,22 +1658,32 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
* PR APTPL Metadata for Reservation
*/
case Opt_res_holder:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
res_holder = arg;
break;
case Opt_res_type:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
type = (u8)arg;
break;
case Opt_res_scope:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
break;
case Opt_res_all_tg_pt:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
all_tg_pt = (int)arg;
break;
case Opt_mapped_lun:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
mapped_lun = (u64)arg;
break;
/*
Expand Down Expand Up @@ -1701,14 +1711,20 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
}
break;
case Opt_tpgt:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
tpgt = (u16)arg;
break;
case Opt_port_rtpi:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
break;
case Opt_target_lun:
match_int(args, &arg);
ret = match_int(args, &arg);
if (ret)
goto out;
target_lun = (u64)arg;
break;
default:
Expand Down

0 comments on commit c209102

Please sign in to comment.