aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-01-31 03:19:09 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2013-02-13 14:27:58 -0500
commit0e48e7a5a345a727d5fd7a06bd6a9e6a67eae2bd (patch)
treedb0ef8e0367dbe427dcb6f6f984db9d9d60e1111 /drivers/target
parent07ea81b6f7d6345e146245c4964640a5a27b5cc5 (diff)
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>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_stat.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c
index 54a6f3834cf0..464b4206a51e 100644
--- a/drivers/target/iscsi/iscsi_target_stat.c
+++ b/drivers/target/iscsi/iscsi_target_stat.c
@@ -429,16 +429,19 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr(
429 struct iscsi_tiqn *tiqn = container_of(igrps, 429 struct iscsi_tiqn *tiqn = container_of(igrps,
430 struct iscsi_tiqn, tiqn_stat_grps); 430 struct iscsi_tiqn, tiqn_stat_grps);
431 struct iscsi_login_stats *lstat = &tiqn->login_stats; 431 struct iscsi_login_stats *lstat = &tiqn->login_stats;
432 unsigned char buf[32]; 432 int ret;
433 433
434 spin_lock(&lstat->lock); 434 spin_lock(&lstat->lock);
435 if (lstat->last_intr_fail_ip_family == AF_INET6) 435 if (lstat->last_intr_fail_ip_family == AF_INET6) {
436 snprintf(buf, 32, "[%s]", lstat->last_intr_fail_ip_addr); 436 ret = snprintf(page, PAGE_SIZE, "[%s]\n",
437 else 437 lstat->last_intr_fail_ip_addr);
438 snprintf(buf, 32, "%s", lstat->last_intr_fail_ip_addr); 438 } else {
439 ret = snprintf(page, PAGE_SIZE, "%s\n",
440 lstat->last_intr_fail_ip_addr);
441 }
439 spin_unlock(&lstat->lock); 442 spin_unlock(&lstat->lock);
440 443
441 return snprintf(page, PAGE_SIZE, "%s\n", buf); 444 return ret;
442} 445}
443ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr); 446ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr);
444 447