From: Johan Hedberg <johan.hedberg@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hidp: Fix handling of strncpy for hid->name information
Date: Mon, 30 Jul 2018 15:10:55 +0300 [thread overview]
Message-ID: <20180730121055.GC31474@x1c.home> (raw)
In-Reply-To: <20180730115741.80946-1-marcel@holtmann.org>
Hi Marcel,
On Mon, Jul 30, 2018, Marcel Holtmann wrote:
> This fixes two issues with setting hid->name information.
>
> CC net/bluetooth/hidp/core.o
> In function ‘hidp_setup_hid’,
> inlined from ‘hidp_session_dev_init’ at net/bluetooth/hidp/core.c:815:9,
> inlined from ‘hidp_session_new’ at net/bluetooth/hidp/core.c:953:8,
> inlined from ‘hidp_connection_add’ at net/bluetooth/hidp/core.c:1366:8:
> net/bluetooth/hidp/core.c:778:2: warning: ‘strncpy’ output may be truncated copying 127 bytes from a string of length 127 [-Wstringop-truncation]
> strncpy(hid->name, req->name, sizeof(req->name) - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> CC net/bluetooth/hidp/core.o
> net/bluetooth/hidp/core.c: In function ‘hidp_setup_hid’:
> net/bluetooth/hidp/core.c:778:38: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
> strncpy(hid->name, req->name, sizeof(req->name));
> ^
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hidp/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
prev parent reply other threads:[~2018-07-30 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 11:57 [PATCH] Bluetooth: hidp: Fix handling of strncpy for hid->name information Marcel Holtmann
2018-07-30 12:10 ` Johan Hedberg [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=20180730121055.GC31474@x1c.home \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.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).