linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2] target: don't truncate the fail intr address
Date: Thu, 31 Jan 2013 12:31:40 -0800	[thread overview]
Message-ID: <1359664300.6300.30.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20130131081909.GC14812@elgon.mountain>

On Thu, 2013-01-31 at 11:19 +0300, Dan Carpenter wrote:
> 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>
> ---

Also applied to for-next.

Thanks Dan!

--nab

> Compile tested only.
> 
> diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c
> index 54a6f38..464b420 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(
>  	struct iscsi_tiqn *tiqn = container_of(igrps,
>  			struct iscsi_tiqn, tiqn_stat_grps);
>  	struct iscsi_login_stats *lstat = &tiqn->login_stats;
> -	unsigned char buf[32];
> +	int ret;
>  
>  	spin_lock(&lstat->lock);
> -	if (lstat->last_intr_fail_ip_family == AF_INET6)
> -		snprintf(buf, 32, "[%s]", lstat->last_intr_fail_ip_addr);
> -	else
> -		snprintf(buf, 32, "%s", lstat->last_intr_fail_ip_addr);
> +	if (lstat->last_intr_fail_ip_family == AF_INET6) {
> +		ret = snprintf(page, PAGE_SIZE, "[%s]\n",
> +			       lstat->last_intr_fail_ip_addr);
> +	} else {
> +		ret = snprintf(page, PAGE_SIZE, "%s\n",
> +			       lstat->last_intr_fail_ip_addr);
> +	}
>  	spin_unlock(&lstat->lock);
>  
> -	return snprintf(page, PAGE_SIZE, "%s\n", buf);
> +	return ret;
>  }
>  ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe target-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



      reply	other threads:[~2013-01-31 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31  8:19 [patch 2/2] target: don't truncate the fail intr address Dan Carpenter
2013-01-31 20:31 ` Nicholas A. Bellinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359664300.6300.30.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).