On 17:21 Wed 14 Oct , Ira Weiny wrote:
>
> From: Ira Weiny <[email protected]>
> 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 <[email protected]>
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html