Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344764
b: refs/heads/master
c: ed72a4d
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Nicholas Bellinger committed Dec 8, 2012
1 parent e934331 commit 5b633de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 778229af95977a4aca8656143d457401c2bb8f96
refs/heads/master: ed72a4d52add345595f09b360d6ac5f20428d361
16 changes: 3 additions & 13 deletions trunk/drivers/target/iscsi/iscsi_target_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,18 @@ static struct iscsi_param *iscsi_set_default_param(struct iscsi_param_list *para
}
INIT_LIST_HEAD(&param->p_list);

param->name = kzalloc(strlen(name) + 1, GFP_KERNEL);
param->name = kstrdup(name, GFP_KERNEL);
if (!param->name) {
pr_err("Unable to allocate memory for parameter name.\n");
goto out;
}

param->value = kzalloc(strlen(value) + 1, GFP_KERNEL);
param->value = kstrdup(value, GFP_KERNEL);
if (!param->value) {
pr_err("Unable to allocate memory for parameter value.\n");
goto out;
}

memcpy(param->name, name, strlen(name));
param->name[strlen(name)] = '\0';
memcpy(param->value, value, strlen(value));
param->value[strlen(value)] = '\0';
param->phase = phase;
param->scope = scope;
param->sender = sender;
Expand Down Expand Up @@ -635,11 +631,8 @@ void iscsi_release_param_list(struct iscsi_param_list *param_list)
list_del(&param->p_list);

kfree(param->name);
param->name = NULL;
kfree(param->value);
param->value = NULL;
kfree(param);
param = NULL;
}

iscsi_release_extra_responses(param_list);
Expand Down Expand Up @@ -687,15 +680,12 @@ int iscsi_update_param_value(struct iscsi_param *param, char *value)
{
kfree(param->value);

param->value = kzalloc(strlen(value) + 1, GFP_KERNEL);
param->value = kstrdup(value, GFP_KERNEL);
if (!param->value) {
pr_err("Unable to allocate memory for value.\n");
return -ENOMEM;
}

memcpy(param->value, value, strlen(value));
param->value[strlen(value)] = '\0';

pr_debug("iSCSI Parameter updated to %s=%s\n",
param->name, param->value);
return 0;
Expand Down

0 comments on commit 5b633de

Please sign in to comment.