Message ID | 20231010215853.629963-1-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | afb47b13c600b0c5e01b4fe3f2e670e89faa6ec2 |
Headers | show |
Series | [BlueZ] input: Fix smatch warning | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | warning | WARNING:EMAIL_SUBJECT: A patch subject line should describe the change not the tool that found it #71: Subject: [PATCH BlueZ] input: Fix smatch warning /github/workspace/src/src/13416197.patch total: 0 errors, 1 warnings, 48 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13416197.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/BuildEll | success | Build ELL PASS |
tedd_an/BluezMake | success | Bluez Make PASS |
tedd_an/MakeCheck | success | Bluez Make Check PASS |
tedd_an/MakeDistcheck | success | Make Distcheck PASS |
tedd_an/CheckValgrind | success | Check Valgrind PASS |
tedd_an/CheckSmatch | success | CheckSparse PASS |
tedd_an/bluezmakeextell | success | Make External ELL PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
tedd_an/ScanBuild | success | Scan Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=791982 ---Test result--- Test Summary: CheckPatch FAIL 0.66 seconds GitLint PASS 0.28 seconds BuildEll PASS 28.97 seconds BluezMake PASS 996.51 seconds MakeCheck PASS 12.73 seconds MakeDistcheck PASS 169.57 seconds CheckValgrind PASS 268.41 seconds CheckSmatch PASS 360.78 seconds bluezmakeextell PASS 111.29 seconds IncrementalBuild PASS 858.81 seconds ScanBuild PASS 1115.70 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ] input: Fix smatch warning WARNING:EMAIL_SUBJECT: A patch subject line should describe the change not the tool that found it #71: Subject: [PATCH BlueZ] input: Fix smatch warning /github/workspace/src/src/13416197.patch total: 0 errors, 1 warnings, 48 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13416197.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --- Regards, Linux Bluetooth
Hello: This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 10 Oct 2023 14:58:52 -0700 you wrote: > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > > This fixes the following warning: > > profiles/input/device.c:165:26: warning: Variable length array is used. > --- > profiles/input/device.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) Here is the summary with links: - [BlueZ] input: Fix smatch warning https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=afb47b13c600 You are awesome, thank you!
diff --git a/profiles/input/device.c b/profiles/input/device.c index 4310dd192e11..6c64ff1c1c52 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -20,6 +20,7 @@ #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> +#include <sys/uio.h> #include "lib/bluetooth.h" #include "lib/hidp.h" @@ -162,32 +163,33 @@ static bool hidp_send_message(GIOChannel *chan, uint8_t hdr, { int fd; ssize_t len; - uint8_t msg[size + 1]; + struct iovec iov[2]; if (!chan) { error("BT socket not connected"); return false; } + iov[0].iov_base = &hdr; + iov[0].iov_len = sizeof(hdr); + if (data == NULL) size = 0; - msg[0] = hdr; - if (size > 0) - memcpy(&msg[1], data, size); - ++size; + iov[1].iov_base = (void *)data; + iov[1].iov_len = size; fd = g_io_channel_unix_get_fd(chan); - len = write(fd, msg, size); + len = writev(fd, iov, 2); if (len < 0) { error("BT socket write error: %s (%d)", strerror(errno), errno); return false; } - if ((size_t) len < size) { + if ((size_t) len < size + 1) { error("BT socket write error: partial write (%zd of %zu bytes)", - len, size); + len, size + 1); return false; }
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> This fixes the following warning: profiles/input/device.c:165:26: warning: Variable length array is used. --- profiles/input/device.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)