diff --git a/iscsi-scst/kernel/config.c b/iscsi-scst/kernel/config.c index 0d2b03ea3..d2136bdd5 100644 --- a/iscsi-scst/kernel/config.c +++ b/iscsi-scst/kernel/config.c @@ -715,8 +715,8 @@ int iscsi_add_attr(struct iscsi_target *target, } list_for_each_entry(tgt_attr, attrs_list, attrs_list_entry) { - if (strncmp(tgt_attr->name, attr_info->name, - sizeof(tgt_attr->name) == 0)) { + /* Both for sure NULL-terminated */ + if (strcmp(tgt_attr->name, attr_info->name) == 0) { PRINT_ERROR("Attribute %s for %s already exist", attr_info->name, name); res = -EEXIST; @@ -753,6 +753,8 @@ int iscsi_add_attr(struct iscsi_target *target, tgt_attr->attr.show = iscsi_attr_show; tgt_attr->attr.store = iscsi_attr_store; + TRACE_DBG("tgt_attr %p, attr %p", tgt_attr, &tgt_attr->attr.attr); + res = sysfs_create_file( (target != NULL) ? scst_sysfs_get_tgt_kobj(target->scst_tgt) : scst_sysfs_get_tgtt_kobj(&iscsi_template), @@ -781,8 +783,9 @@ void __iscsi_del_attr(struct iscsi_target *target, { TRACE_ENTRY(); - TRACE_DBG("Deleting %s's attr %s", - (target != NULL) ? target->name : "global", tgt_attr->name); + TRACE_DBG("Deleting attr %s (target %s, tgt_attr %p, attr %p)", + tgt_attr->name, (target != NULL) ? target->name : "global", + tgt_attr, &tgt_attr->attr.attr); list_del(&tgt_attr->attrs_list_entry); @@ -818,7 +821,8 @@ static int iscsi_del_attr(struct iscsi_target *target, tgt_attr = NULL; list_for_each_entry(a, attrs_list, attrs_list_entry) { - if (strncmp(a->name, attr_name, sizeof(a->name)) == 0) { + /* Both for sure NULL-terminated */ + if (strcmp(a->name, attr_name) == 0) { tgt_attr = a; break; } diff --git a/iscsi-scst/usr/config.c b/iscsi-scst/usr/config.c index 2a2210571..681cb35eb 100644 --- a/iscsi-scst/usr/config.c +++ b/iscsi-scst/usr/config.c @@ -444,6 +444,11 @@ int config_account_del(u32 tid, int dir, char *name, u32 cookie) goto out; } + log_debug(1, "Deleting %s user %s (%p, target %s, sysfs name %s)", + (dir == ISCSI_USER_DIR_OUTGOING) ? "outgoing" : "incoming", + ISCSI_USER_NAME(user), user, target ? target->name : "discovery", + user->sysfs_name); + #ifndef CONFIG_SCST_PROC res = kernel_user_del(target, user, cookie); if (res != 0) @@ -522,10 +527,6 @@ int __config_account_add(struct target *target, int dir, char *name, if (err != 0) goto out; - log_debug(1, "User %s added to target %s (direction %s)", ISCSI_USER_NAME(user), - target ? target->name : "discovery", - (dir == ISCSI_USER_DIR_OUTGOING) ? "outgoing" : "incoming"); - #ifndef CONFIG_SCST_PROC if (send_to_kern && (sysfs_name != NULL)) { err = kernel_user_add(target, user, cookie); @@ -534,6 +535,11 @@ int __config_account_add(struct target *target, int dir, char *name, } #endif + log_debug(1, "User %s (%p, sysfs name %s) added to target %s " + "(direction %s)", ISCSI_USER_NAME(user), user, user->sysfs_name, + target ? target->name : "discovery", + (dir == ISCSI_USER_DIR_OUTGOING) ? "outgoing" : "incoming"); + out: return err;