* [PATCH BlueZ v1] tools/rctest: add NULL checks to main()
@ 2024-07-15 8:47 Roman Smirnov
2024-07-15 10:43 ` [BlueZ,v1] " bluez.test.bot
2024-08-13 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-07-15 8:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Roman Smirnov
It is necessary to prevent dereferencing of a NULL pointer.
Found with the SVACE static analysis tool.
---
tools/rctest.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/tools/rctest.c b/tools/rctest.c
index b72be917c..367e41e3c 100644
--- a/tools/rctest.c
+++ b/tools/rctest.c
@@ -742,6 +742,9 @@ int main(int argc, char *argv[])
break;
case 'a':
+ if (!optarg)
+ break;
+
mode = AUTO;
if (!strncasecmp(optarg, "hci", 3))
@@ -756,6 +759,9 @@ int main(int argc, char *argv[])
break;
case 'i':
+ if (!optarg)
+ break;
+
if (!strncasecmp(optarg, "hci", 3))
hci_devba(atoi(optarg + 3), &bdaddr);
else
@@ -763,10 +769,14 @@ int main(int argc, char *argv[])
break;
case 'P':
- channel = atoi(optarg);
+ if (optarg)
+ channel = atoi(optarg);
break;
case 'U':
+ if (!optarg)
+ break;
+
if (!strcasecmp(optarg, "spp"))
uuid = SERIAL_PORT_SVCLASS_ID;
else if (!strncasecmp(optarg, "0x", 2))
@@ -792,11 +802,13 @@ int main(int argc, char *argv[])
break;
case 'L':
- linger = atoi(optarg);
+ if (optarg)
+ linger = atoi(optarg);
break;
case 'W':
- defer_setup = atoi(optarg);
+ if (optarg)
+ defer_setup = atoi(optarg);
break;
case 'B':
@@ -808,19 +820,23 @@ int main(int argc, char *argv[])
break;
case 'N':
- num_frames = atoi(optarg);
+ if (optarg)
+ num_frames = atoi(optarg);
break;
case 'C':
- count = atoi(optarg);
+ if (optarg)
+ count = atoi(optarg);
break;
case 'D':
- delay = atoi(optarg) * 1000;
+ if (optarg)
+ delay = atoi(optarg) * 1000;
break;
case 'Y':
- priority = atoi(optarg);
+ if (optarg)
+ priority = atoi(optarg);
break;
case 'T':
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ,v1] tools/rctest: add NULL checks to main()
2024-07-15 8:47 [PATCH BlueZ v1] tools/rctest: add NULL checks to main() Roman Smirnov
@ 2024-07-15 10:43 ` bluez.test.bot
2024-08-13 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-07-15 10:43 UTC (permalink / raw)
To: linux-bluetooth, r.smirnov
[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]
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=871273
---Test result---
Test Summary:
CheckPatch PASS 0.43 seconds
GitLint PASS 0.29 seconds
BuildEll PASS 24.76 seconds
BluezMake PASS 1633.82 seconds
MakeCheck PASS 12.95 seconds
MakeDistcheck PASS 177.47 seconds
CheckValgrind PASS 251.61 seconds
CheckSmatch WARNING 355.07 seconds
bluezmakeextell PASS 119.84 seconds
IncrementalBuild PASS 1551.92 seconds
ScanBuild PASS 1024.58 seconds
Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
tools/rctest.c:627:33: warning: non-ANSI function declaration of function 'automated_send_recv'
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v1] tools/rctest: add NULL checks to main()
2024-07-15 8:47 [PATCH BlueZ v1] tools/rctest: add NULL checks to main() Roman Smirnov
2024-07-15 10:43 ` [BlueZ,v1] " bluez.test.bot
@ 2024-08-13 15:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-08-13 15:50 UTC (permalink / raw)
To: Roman Smirnov; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 15 Jul 2024 11:47:01 +0300 you wrote:
> It is necessary to prevent dereferencing of a NULL pointer.
>
> Found with the SVACE static analysis tool.
> ---
> tools/rctest.c | 30 +++++++++++++++++++++++-------
> 1 file changed, 23 insertions(+), 7 deletions(-)
Here is the summary with links:
- [BlueZ,v1] tools/rctest: add NULL checks to main()
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b752f760da47
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-13 15:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15 8:47 [PATCH BlueZ v1] tools/rctest: add NULL checks to main() Roman Smirnov
2024-07-15 10:43 ` [BlueZ,v1] " bluez.test.bot
2024-08-13 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
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).