diff mbox series

[BlueZ,v1] shared/util: Fix build error on malloc0

Message ID 20240507204407.653383-1-luiz.dentz@gmail.com
State Superseded
Headers show
Series [BlueZ,v1] shared/util: Fix build error on malloc0 | expand

Commit Message

Luiz Augusto von Dentz May 7, 2024, 8:44 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes the parameter order of calloc which causes the following
error on recent gcc:

CC    client/mgmt.o
In file included from client/mgmt.c:43:
client/mgmt.c: In function ‘cmd_add_ext_adv_params’:
client/mgmt.c:5057:28: error: ‘calloc’ sizes specified with ‘sizeof’ in
the earlier argument and not in the later argument
[-Werror=calloc-transposed-args]
 5057 |     cp = malloc0(sizeof(*cp));
   |
---
 src/shared/util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com May 7, 2024, 10:35 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=851339

---Test result---

Test Summary:
CheckPatch                    PASS      0.39 seconds
GitLint                       PASS      0.27 seconds
BuildEll                      PASS      24.43 seconds
BluezMake                     PASS      1629.76 seconds
MakeCheck                     PASS      12.91 seconds
MakeDistcheck                 PASS      174.55 seconds
CheckValgrind                 PASS      245.00 seconds
CheckSmatch                   PASS      348.33 seconds
bluezmakeextell               PASS      118.12 seconds
IncrementalBuild              PASS      1401.47 seconds
ScanBuild                     PASS      977.73 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org May 8, 2024, 9:10 p.m. UTC | #2
Hello:

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

On Tue,  7 May 2024 16:44:07 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This fixes the parameter order of calloc which causes the following
> error on recent gcc:
> 
> CC    client/mgmt.o
> In file included from client/mgmt.c:43:
> client/mgmt.c: In function ‘cmd_add_ext_adv_params’:
> client/mgmt.c:5057:28: error: ‘calloc’ sizes specified with ‘sizeof’ in
> the earlier argument and not in the later argument
> [-Werror=calloc-transposed-args]
>  5057 |     cp = malloc0(sizeof(*cp));
>    |
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] shared/util: Fix build error on malloc0
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=449cf35032e5

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/util.h b/src/shared/util.h
index a8ba23499289..bd71577d60c0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -85,7 +85,7 @@  do {						\
 	}))
 
 #define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
-#define malloc0(n) (calloc((n), 1))
+#define malloc0(n) (calloc(1, (n)))
 
 char *strdelimit(char *str, char *del, char c);
 int strsuffix(const char *str, const char *suffix);