2022-08-29 21:48:42

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] shell: Set empty argument if optarg is NULL

From: Luiz Augusto von Dentz <[email protected]>

This sets enmpty string ("") when argument don't set any optarg so the
application can tell when an option was set or not.
---
src/shared/shell.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index dfda8128af91..4658819a4bde 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1158,7 +1158,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
return;
}

- *opt->optarg[index - offset] = optarg;
+ *opt->optarg[index - offset] = optarg ? : "";
}

index = -1;
--
2.37.2


2022-08-29 22:40:49

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,1/2] shell: Set empty argument if optarg is NULL

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

---Test result---

Test Summary:
CheckPatch FAIL 2.26 seconds
GitLint PASS 1.52 seconds
Prep - Setup ELL PASS 32.33 seconds
Build - Prep PASS 0.79 seconds
Build - Configure PASS 10.36 seconds
Build - Make PASS 958.09 seconds
Make Check PASS 13.15 seconds
Make Check w/Valgrind PASS 348.11 seconds
Make Distcheck PASS 292.00 seconds
Build w/ext ELL - Configure PASS 10.67 seconds
Build w/ext ELL - Make PASS 100.25 seconds
Incremental Build w/ patches PASS 237.25 seconds
Scan Build WARNING 643.54 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,2/2] client: Add -e/--endpoint option to auto register endpoints
WARNING:LINE_SPACING: Missing a blank line after declarations
#216: FILE: client/player.c:625:
+ GDBusProxy *proxy = l->data;
+ print_player(proxy, NULL);

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


##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
client/player.c:1758:25: warning: Dereference of null pointer
iov_append(&cfg->caps, preset->data.iov_base, preset->data.iov_len);
^~~~~~~~~~~~~~~~~~~~~
1 warning generated.
src/shared/shell.c:1135:19: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data.timeout = atoi(optarg);
^~~~~~~~~~~~
src/shared/shell.c:1155:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
if (c != opt->options[index - offset].val) {
^~~~~~~~~~~~
2 warnings generated.




---
Regards,
Linux Bluetooth

2022-08-30 21:41:00

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] shell: Set empty argument if optarg is NULL

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Mon, 29 Aug 2022 14:37:37 -0700 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This sets enmpty string ("") when argument don't set any optarg so the
> application can tell when an option was set or not.
> ---
> src/shared/shell.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [BlueZ,1/2] shell: Set empty argument if optarg is NULL
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=75f73f6d6264
- [BlueZ,2/2] client: Add -e/--endpoint option to auto register endpoints
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d297a5873d21

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html