diff mbox series

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

Message ID 20220829213738.779598-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 75f73f6d62645734f9e7a2385902750cf3ad3f16
Headers show
Series [BlueZ,1/2] shell: Set empty argument if optarg is NULL | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS
tedd_an/incremental_build success Pass
tedd_an/scan_build warning Scan-Build: 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.

Commit Message

Luiz Augusto von Dentz Aug. 29, 2022, 9:37 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

Comments

bluez.test.bot@gmail.com Aug. 29, 2022, 10:30 p.m. UTC | #1
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
patchwork-bot+bluetooth@kernel.org Aug. 30, 2022, 9:30 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 29 Aug 2022 14:37:37 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
diff mbox series

Patch

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;