2022-05-09 03:50:44

by Ildar Kamaletdinov

[permalink] [raw]
Subject: [PATCH BlueZ 1/4] tools: Fix memory leak in hciconfig

printf() was using function that return dynamic allocated memory as
a parameter.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
tools/hciconfig.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index e4d521583..e1b73f22a 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -80,7 +80,11 @@ static void print_pkt_type(struct hci_dev_info *di)

static void print_link_policy(struct hci_dev_info *di)
{
- printf("\tLink policy: %s\n", hci_lptostr(di->link_policy));
+ char *str;
+
+ str = hci_lptostr(di->link_policy);
+ printf("\tLink policy: %s\n", str);
+ bt_free(str);
}

static void print_link_mode(struct hci_dev_info *di)
--
2.35.3



2022-05-09 08:41:36

by bluez.test.bot

[permalink] [raw]
Subject: RE: Fix few more bugs found by SVACE

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=639427

---Test result---

Test Summary:
CheckPatch FAIL 5.66 seconds
GitLint PASS 3.95 seconds
Prep - Setup ELL PASS 42.99 seconds
Build - Prep PASS 0.68 seconds
Build - Configure PASS 8.64 seconds
Build - Make PASS 1360.55 seconds
Make Check PASS 11.83 seconds
Make Check w/Valgrind PASS 444.92 seconds
Make Distcheck PASS 230.71 seconds
Build w/ext ELL - Configure PASS 8.64 seconds
Build w/ext ELL - Make PASS 1380.96 seconds
Incremental Build with patchesPASS 5642.52 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,1/4] tools: Fix memory leak in hciconfig
ERROR:TRAILING_WHITESPACE: trailing whitespace
#68: FILE: tools/hciconfig.c:84:
+^I$

/github/workspace/src/12842099.patch total: 1 errors, 0 warnings, 12 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.

NOTE: Whitespace errors detected.
You may wish to use scripts/cleanpatch or scripts/cleanfile

/github/workspace/src/12842099.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