aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/target/iscsi/iscsi_target_auth.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
index 19b842c3e0b3..9430eea7c0d6 100644
--- a/drivers/target/iscsi/iscsi_target_auth.c
+++ b/drivers/target/iscsi/iscsi_target_auth.c
@@ -174,7 +174,6 @@ static int chap_server_compute_md5(
174 char *nr_out_ptr, 174 char *nr_out_ptr,
175 unsigned int *nr_out_len) 175 unsigned int *nr_out_len)
176{ 176{
177 char *endptr;
178 unsigned long id; 177 unsigned long id;
179 unsigned char id_as_uchar; 178 unsigned char id_as_uchar;
180 unsigned char digest[MD5_SIGNATURE_SIZE]; 179 unsigned char digest[MD5_SIGNATURE_SIZE];
@@ -320,9 +319,14 @@ static int chap_server_compute_md5(
320 } 319 }
321 320
322 if (type == HEX) 321 if (type == HEX)
323 id = simple_strtoul(&identifier[2], &endptr, 0); 322 ret = kstrtoul(&identifier[2], 0, &id);
324 else 323 else
325 id = simple_strtoul(identifier, &endptr, 0); 324 ret = kstrtoul(identifier, 0, &id);
325
326 if (ret < 0) {
327 pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret);
328 goto out;
329 }
326 if (id > 255) { 330 if (id > 255) {
327 pr_err("chap identifier: %lu greater than 255\n", id); 331 pr_err("chap identifier: %lu greater than 255\n", id);
328 goto out; 332 goto out;