* [PATCH BlueZ] tools: Fix static analysis warnings
@ 2021-01-22 19:42 Brian Gix
2021-01-22 22:58 ` [BlueZ] " bluez.test.bot
2021-01-26 21:31 ` [PATCH BlueZ] " Gix, Brian
0 siblings, 2 replies; 3+ messages in thread
From: Brian Gix @ 2021-01-22 19:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, Brian Gix
Usage of potentially NULL pointers
---
tools/btmgmt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 383e7199e..f4eb541fa 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -4912,6 +4912,12 @@ static void cmd_advmon_add_pattern(int argc, char **argv)
cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
cp = malloc0(cp_len);
+ if (!cp) {
+ error("Failed to alloc patterns.");
+ success = false;
+ goto done;
+ }
+
cp->pattern_count = argc;
for (i = 0; i < argc; i++) {
@@ -4987,6 +4993,12 @@ static void cmd_advmon_add_pattern_rssi(int argc, char **argv)
cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
cp = malloc0(cp_len);
+ if (!cp) {
+ error("Failed to alloc patterns.");
+ success = false;
+ goto done;
+ }
+
cp->pattern_count = argc;
cp->rssi.high_threshold = rssi_high;
cp->rssi.low_threshold = rssi_low;
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ] tools: Fix static analysis warnings
2021-01-22 19:42 [PATCH BlueZ] tools: Fix static analysis warnings Brian Gix
@ 2021-01-22 22:58 ` bluez.test.bot
2021-01-26 21:31 ` [PATCH BlueZ] " Gix, Brian
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-01-22 22:58 UTC (permalink / raw)
To: linux-bluetooth, brian.gix
[-- Attachment #1: Type: text/plain, Size: 557 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=420291
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ] tools: Fix static analysis warnings
2021-01-22 19:42 [PATCH BlueZ] tools: Fix static analysis warnings Brian Gix
2021-01-22 22:58 ` [BlueZ] " bluez.test.bot
@ 2021-01-26 21:31 ` Gix, Brian
1 sibling, 0 replies; 3+ messages in thread
From: Gix, Brian @ 2021-01-26 21:31 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz
Applied
On Fri, 2021-01-22 at 11:42 -0800, Brian Gix wrote:
> Usage of potentially NULL pointers
> ---
> tools/btmgmt.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/btmgmt.c b/tools/btmgmt.c
> index 383e7199e..f4eb541fa 100644
> --- a/tools/btmgmt.c
> +++ b/tools/btmgmt.c
> @@ -4912,6 +4912,12 @@ static void cmd_advmon_add_pattern(int argc, char **argv)
>
> cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
> cp = malloc0(cp_len);
> + if (!cp) {
> + error("Failed to alloc patterns.");
> + success = false;
> + goto done;
> + }
> +
> cp->pattern_count = argc;
>
> for (i = 0; i < argc; i++) {
> @@ -4987,6 +4993,12 @@ static void cmd_advmon_add_pattern_rssi(int argc, char **argv)
>
> cp_len = sizeof(*cp) + argc * sizeof(struct mgmt_adv_pattern);
> cp = malloc0(cp_len);
> + if (!cp) {
> + error("Failed to alloc patterns.");
> + success = false;
> + goto done;
> + }
> +
> cp->pattern_count = argc;
> cp->rssi.high_threshold = rssi_high;
> cp->rssi.low_threshold = rssi_low;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-26 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 19:42 [PATCH BlueZ] tools: Fix static analysis warnings Brian Gix
2021-01-22 22:58 ` [BlueZ] " bluez.test.bot
2021-01-26 21:31 ` [PATCH BlueZ] " Gix, Brian
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).