[PATCH 2/3] profiles/midi: Fix compilation with GCC 8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux