target: don't truncate the fail intr address
The temporary buffer was only 32 characters but ->last_intr_fail_ip_addr is a 48 character buffer. We don't need to use a temporary buffer at all, we can just print directly to "page". Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
committed by
Nicholas Bellinger
parent
07ea81b6f7
commit
0e48e7a5a3
@@ -429,16 +429,19 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr(
|
|||||||
struct iscsi_tiqn *tiqn = container_of(igrps,
|
struct iscsi_tiqn *tiqn = container_of(igrps,
|
||||||
struct iscsi_tiqn, tiqn_stat_grps);
|
struct iscsi_tiqn, tiqn_stat_grps);
|
||||||
struct iscsi_login_stats *lstat = &tiqn->login_stats;
|
struct iscsi_login_stats *lstat = &tiqn->login_stats;
|
||||||
unsigned char buf[32];
|
int ret;
|
||||||
|
|
||||||
spin_lock(&lstat->lock);
|
spin_lock(&lstat->lock);
|
||||||
if (lstat->last_intr_fail_ip_family == AF_INET6)
|
if (lstat->last_intr_fail_ip_family == AF_INET6) {
|
||||||
snprintf(buf, 32, "[%s]", lstat->last_intr_fail_ip_addr);
|
ret = snprintf(page, PAGE_SIZE, "[%s]\n",
|
||||||
else
|
lstat->last_intr_fail_ip_addr);
|
||||||
snprintf(buf, 32, "%s", lstat->last_intr_fail_ip_addr);
|
} else {
|
||||||
|
ret = snprintf(page, PAGE_SIZE, "%s\n",
|
||||||
|
lstat->last_intr_fail_ip_addr);
|
||||||
|
}
|
||||||
spin_unlock(&lstat->lock);
|
spin_unlock(&lstat->lock);
|
||||||
|
|
||||||
return snprintf(page, PAGE_SIZE, "%s\n", buf);
|
return ret;
|
||||||
}
|
}
|
||||||
ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr);
|
ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user