From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@codecoup.pl>
Subject: [PATCH 2/3] profiles/midi: Fix compilation with GCC 8
Date: Wed, 9 May 2018 14:11:12 +0200 [thread overview]
Message-ID: <20180509121113.4110-2-szymon.janc@codecoup.pl> (raw)
In-Reply-To: <20180509121113.4110-1-szymon.janc@codecoup.pl>
We can use strcpy here since addr is smaller.
CC profiles/midi/bluetoothd-midi.o
profiles/midi/midi.c: In function ‘midi_accept’:
profiles/midi/midi.c:307:36: error: argument to ‘sizeof’
in ‘strncpy’ call is the same expression as the source;
did you mean to use the size of the destination?
[-Werror=sizeof-pointer-memaccess]
strncpy(device_name, addr, sizeof(addr));
^
cc1: all warnings being treated as errors
---
profiles/midi/midi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/midi/midi.c b/profiles/midi/midi.c
index fdc1c007d..9e04d19e3 100644
--- a/profiles/midi/midi.c
+++ b/profiles/midi/midi.c
@@ -304,7 +304,7 @@ static int midi_accept(struct btd_service *service)
if (device_name_known(device))
device_get_name(device, device_name, sizeof(device_name));
else
- strncpy(device_name, addr, sizeof(addr));
+ strcpy(device_name, addr);
/* ALSA Sequencer Client and Port Setup */
err = snd_seq_open(&midi->seq_handle, "default", SND_SEQ_OPEN_DUPLEX, 0);
--
2.17.0
next prev parent reply other threads:[~2018-05-09 12:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 12:11 [PATCH 1/3] build: Disable some warnings from GCC 8 Szymon Janc
2018-05-09 12:11 ` Szymon Janc [this message]
2018-05-09 12:11 ` [PATCH 3/3] android/client: Fix compilation with " Szymon Janc
2018-05-25 8:03 ` Szymon Janc
2018-05-09 12:26 ` [PATCH 1/3] build: Disable some warnings from " Marcel Holtmann
2018-05-09 13:04 ` Szymon Janc
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=20180509121113.4110-2-szymon.janc@codecoup.pl \
--to=szymon.janc@codecoup.pl \
--cc=linux-bluetooth@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).