All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"ebiggers3@gmail.com" <ebiggers3@gmail.com>
Cc: "ebiggers@google.com" <ebiggers@google.com>
Subject: Re: [PATCH] elevator: fix truncation of icq_cache_name
Date: Tue, 6 Jun 2017 17:10:19 +0000	[thread overview]
Message-ID: <1496769018.2692.12.camel@sandisk.com> (raw)
In-Reply-To: <20170603033551.17261-1-ebiggers3@gmail.com>

On Fri, 2017-06-02 at 20:35 -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>=20
> gcc 7.1 reports the following warning:
>=20
>     block/elevator.c: In function =91elv_register=92:
>     block/elevator.c:898:5: warning: =91snprintf=92 output may be truncat=
ed before the last format character [-Wformat-truncation=3D]
>          "%s_io_cq", e->elevator_name);
>          ^~~~~~~~~~
>     block/elevator.c:897:3: note: =91snprintf=92 output between 7 and 22 =
bytes into a destination of size 21
>        snprintf(e->icq_cache_name, sizeof(e->icq_cache_name),
>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>          "%s_io_cq", e->elevator_name);
>          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>=20
> The bug is that the name of the icq_cache is 6 characters longer than
> the elevator name, but only ELV_NAME_MAX + 5 characters were reserved
> for it --- so in the case of a maximum-length elevator name, the 'q'
> character in "_io_cq" would be truncated by snprintf().  Fix it by
> reserving ELV_NAME_MAX + 6 characters instead.

Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>=

  reply	other threads:[~2017-06-06 17:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03  3:35 [PATCH] elevator: fix truncation of icq_cache_name Eric Biggers
2017-06-06 17:10 ` Bart Van Assche [this message]
2017-06-06 17:21 ` Jens Axboe

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=1496769018.2692.12.camel@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=ebiggers3@gmail.com \
    --cc=ebiggers@google.com \
    --cc=linux-block@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 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.