From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed
Date: Thu, 15 Oct 2009 21:15:50 +0200 [thread overview]
Message-ID: <20091015191550.GD20210@me> (raw)
In-Reply-To: <20091014172120.3cb11b5a.weiny2-i2BcT+NCU+M@public.gmane.org>
On 17:21 Wed 14 Oct , Ira Weiny wrote:
>
> From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
> Date: Wed, 14 Oct 2009 17:05:53 -0700
> Subject: [PATCH] opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed
>
> When printing cached options strings which fill the print buffer.
> Adjust the length so the final snprintf(..., "\n"); can succeed.
>
> Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Applied. Thanks.
> ---
> opensm/opensm/osm_subnet.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
> index 647950e..ab9c327 100644
> --- a/opensm/opensm/osm_subnet.c
> +++ b/opensm/opensm/osm_subnet.c
> @@ -105,8 +105,8 @@ static void log_config_value(char *name, const char *fmt, ...)
> if (n > sizeof(buf))
> n = sizeof(buf);
> n += vsnprintf(buf + n, sizeof(buf) - n, fmt, args);
> - if (n > sizeof(buf))
> - n = sizeof(buf);
> + if (n >= sizeof(buf)-1)
I'm changing this to 'n > sizeof(buf) - 2' to match below line.
> + n = sizeof(buf)-2;
Sasha
> snprintf(buf + n, sizeof(buf) - n, "\n");
> va_end(args);
> printf("%s", buf);
> --
> 1.5.4.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2009-10-15 19:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 0:21 [PATCH] opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed Ira Weiny
[not found] ` <20091014172120.3cb11b5a.weiny2-i2BcT+NCU+M@public.gmane.org>
2009-10-15 19:15 ` Sasha Khapyorsky [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=20091015191550.GD20210@me \
--to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=weiny2-i2BcT+NCU+M@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.