diff mbox series

[BlueZ,v2,1/2] shared/util: Add util_iov_new function

Message ID 20240619095119.167652-2-vlad.pruteanu@nxp.com (mailing list archive)
State Accepted
Commit 503ecbc655c5115a09ae1b1fc2cde3fe5bda9203
Headers show
Series bap: Allocate memory for broadcast code | 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/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild warning ScanBuild: In file included from tools/mesh-gatt/crypto.c:32: ./src/shared/util.h:240:9: warning: 1st function call argument is an uninitialized value return be32_to_cpu(get_unaligned((const uint32_t *) ptr)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./src/shared/util.h:33:26: note: expanded from macro 'be32_to_cpu' #define be32_to_cpu(val) bswap_32(val) ^~~~~~~~~~~~~ /usr/include/byteswap.h:34:21: note: expanded from macro 'bswap_32' #define bswap_32(x) __bswap_32 (x) ^~~~~~~~~~~~~~ In file included from tools/mesh-gatt/crypto.c:32: ./src/shared/util.h:250:9: warning: 1st function call argument is an uninitialized value return be64_to_cpu(get_unaligned((const uint64_t *) ptr)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./src/shared/util.h:34:26: note: expanded from macro 'be64_to_cpu' #define be64_to_cpu(val) bswap_64(val) ^~~~~~~~~~~~~ /usr/include/byteswap.h:37:21: note: expanded from macro 'bswap_64' #define bswap_64(x) __bswap_64 (x) ^~~~~~~~~~~~~~ 2 warnings generated.

Commit Message

Vlad Pruteanu June 19, 2024, 9:51 a.m. UTC
This adds the util_iov_new function that allows the user both allocated
and set an iovec to the desired value, using only one function call.
---
 src/shared/util.c | 10 ++++++++++
 src/shared/util.h |  1 +
 2 files changed, 11 insertions(+)

Comments

bluez.test.bot@gmail.com June 19, 2024, 12:07 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=863362

---Test result---

Test Summary:
CheckPatch                    PASS      0.95 seconds
GitLint                       PASS      0.67 seconds
BuildEll                      PASS      24.51 seconds
BluezMake                     PASS      1675.31 seconds
MakeCheck                     PASS      13.64 seconds
MakeDistcheck                 PASS      176.61 seconds
CheckValgrind                 PASS      250.75 seconds
CheckSmatch                   PASS      352.42 seconds
bluezmakeextell               PASS      119.14 seconds
IncrementalBuild              PASS      2986.68 seconds
ScanBuild                     WARNING   1020.79 seconds

Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
In file included from tools/mesh-gatt/crypto.c:32:
./src/shared/util.h:240:9: warning: 1st function call argument is an uninitialized value
        return be32_to_cpu(get_unaligned((const uint32_t *) ptr));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/shared/util.h:33:26: note: expanded from macro 'be32_to_cpu'
#define be32_to_cpu(val) bswap_32(val)
                         ^~~~~~~~~~~~~
/usr/include/byteswap.h:34:21: note: expanded from macro 'bswap_32'
#define bswap_32(x) __bswap_32 (x)
                    ^~~~~~~~~~~~~~
In file included from tools/mesh-gatt/crypto.c:32:
./src/shared/util.h:250:9: warning: 1st function call argument is an uninitialized value
        return be64_to_cpu(get_unaligned((const uint64_t *) ptr));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/shared/util.h:34:26: note: expanded from macro 'be64_to_cpu'
#define be64_to_cpu(val) bswap_64(val)
                         ^~~~~~~~~~~~~
/usr/include/byteswap.h:37:21: note: expanded from macro 'bswap_64'
#define bswap_64(x) __bswap_64 (x)
                    ^~~~~~~~~~~~~~
2 warnings generated.



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/util.c b/src/shared/util.c
index 6a29b5068..30f054a5e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -542,6 +542,16 @@  void *util_iov_append(struct iovec *iov, const void *data, size_t len)
 	return util_iov_push_mem(iov, len, data);
 }
 
+struct iovec *util_iov_new(void *data, size_t len)
+{
+	struct iovec *iov;
+
+	iov = new0(struct iovec, 1);
+	util_iov_append(iov, data, len);
+
+	return iov;
+}
+
 void *util_iov_pull(struct iovec *iov, size_t len)
 {
 	if (!iov)
diff --git a/src/shared/util.h b/src/shared/util.h
index bd71577d6..f2ca4f29f 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -176,6 +176,7 @@  void *util_iov_push_le16(struct iovec *iov, uint16_t val);
 void *util_iov_push_be16(struct iovec *iov, uint16_t val);
 void *util_iov_push_u8(struct iovec *iov, uint8_t val);
 void *util_iov_append(struct iovec *iov, const void *data, size_t len);
+struct iovec *util_iov_new(void *data, size_t len);
 void *util_iov_pull(struct iovec *iov, size_t len);
 void *util_iov_pull_mem(struct iovec *iov, size_t len);
 void *util_iov_pull_le64(struct iovec *iov, uint64_t *val);