diff options
| author | David Disseldorp <ddiss@suse.de> | 2015-07-12 18:49:18 +0200 | 
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-07-23 23:41:22 -0700 | 
| commit | c20910264c367a5dfbf6c09e8ec2ff0c5c52857a (patch) | |
| tree | 9d501d4c6e9c279ee36979610de3a4f7932b89c3 | |
| parent | 9105bfc038ca5a506404ce37cd3c0e85f76351e3 (diff) | |
target/configfs: handle match_int() errors
As a follow up to ce31c1b0dc4038a1dec64585d892adb73d9c45f4 - 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>
| -rw-r--r-- | drivers/target/target_core_configfs.c | 32 | 
1 files changed, 24 insertions, 8 deletions
| diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 7f3cb3a2b783..c2e9fea90b4a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -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;  		/* @@ -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: | 
