Skip to content

Commit 1e1645c

Browse files
dpotmaneboasson
authored andcommittedAug 23, 2022
Add Coverity annotations to mark issues false positives or intentional
Signed-off-by: Dennis Potman <[email protected]>
1 parent 65e8d8f commit 1e1645c

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed
 

‎src/core/ddsc/tests/xtypes.c

+4
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ CU_Test (ddsc_xtypes, invalid_top_level_local_hash, .init = xtypes_init, .fini =
626626

627627
for (uint32_t n = 0; n < 6; n++)
628628
{
629+
// coverity[store_writes_const_field]
629630
memcpy (&desc, &XSpace_to_toplevel_desc, sizeof (desc));
630631
typeinfo_deser (&ti, &desc.type_information);
631632
if (n % 2)
@@ -656,6 +657,7 @@ CU_Test (ddsc_xtypes, invalid_top_level_local_non_hash, .init = xtypes_init, .fi
656657
char topic_name[100];
657658

658659
dds_topic_descriptor_t desc;
660+
// coverity[store_writes_const_field]
659661
memcpy (&desc, &XSpace_to_toplevel_desc, sizeof (desc));
660662

661663
DDS_XTypes_TypeInformation *ti;
@@ -720,6 +722,7 @@ static void mod_arraybound (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair
720722

721723
static void modify_type_meta (dds_topic_descriptor_t *dst_desc, const dds_topic_descriptor_t *src_desc, typeobj_modify mod, bool update_typeinfo, uint32_t kind)
722724
{
725+
// coverity[store_writes_const_field]
723726
memcpy (dst_desc, src_desc, sizeof (*dst_desc));
724727

725728
DDS_XTypes_TypeInformation *ti = NULL;
@@ -844,6 +847,7 @@ CU_Test (ddsc_xtypes, invalid_top_level_remote_hash, .init = xtypes_init, .fini
844847
CU_ASSERT_FATAL (topic > 0);
845848

846849
// create type id with invalid top-level
850+
// coverity[store_writes_const_field]
847851
memcpy (&desc, &XSpace_to_toplevel_desc, sizeof (desc));
848852
typeinfo_deser (&ti, &desc.type_information);
849853
ddsi_typeid_fini_impl (&ti->minimal.typeid_with_size.type_id);

‎src/core/ddsi/src/ddsi_typebuilder.c

+1
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,7 @@ static dds_return_t get_topic_descriptor (dds_topic_descriptor_t *desc, struct t
18161816
ret = DDS_RETCODE_OUT_OF_RESOURCES;
18171817
goto err;
18181818
}
1819+
// coverity[store_writes_const_field]
18191820
memcpy (desc, &d, sizeof (*desc));
18201821
ret = DDS_RETCODE_OK;
18211822

‎src/core/ddsi/tests/radmin.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static void setup (void)
3838
// internal processing has various asserts that it isn't an application thread
3939
// doing the dirty work
4040
thrst = lookup_thread_state ();
41+
// coverity[missing_lock:FALSE]
4142
assert (thrst->state == THREAD_STATE_LAZILY_CREATED);
4243
thrst->state = THREAD_STATE_ALIVE;
4344
ddsrt_atomic_stvoidp (&thrst->gv, &gv);
@@ -62,6 +63,7 @@ static void teardown (void)
6263

6364
// On shutdown, there is an expectation that the thread was discovered dynamically.
6465
// We overrode it in the setup code, we undo it now.
66+
// coverity[missing_lock:FALSE]
6567
thrst->state = THREAD_STATE_LAZILY_CREATED;
6668
thread_states_fini ();
6769
ddsi_iid_fini ();
@@ -109,6 +111,8 @@ static void check_reorder (struct nn_reorder *reorder, uint64_t ndiscard, seqno_
109111
static void insert_sample (struct nn_defrag *defrag, struct nn_reorder *reorder, struct nn_rmsg *rmsg, struct receiver_state *rst, seqno_t seq)
110112
{
111113
struct nn_rsample_info *si = nn_rmsg_alloc (rmsg, sizeof (*si));
114+
CU_ASSERT_FATAL (si != NULL);
115+
assert (si);
112116
// only "seq" and "size" really matter
113117
memset (si, 0, sizeof (*si));
114118
si->rst = rst;
@@ -117,7 +121,7 @@ static void insert_sample (struct nn_defrag *defrag, struct nn_reorder *reorder,
117121
struct nn_rdata *rdata = nn_rdata_new (rmsg, 0, si->size, 0, 0, 0);
118122
struct nn_rsample *rsample = nn_defrag_rsample (defrag, rdata, si);
119123
CU_ASSERT_FATAL (rsample != NULL);
120-
124+
121125
struct nn_rsample_chain sc;
122126
int refc_adjust = 0;
123127
struct nn_rdata *fragchain = nn_rsample_fragchain (rsample);

‎src/security/builtin_plugins/cryptographic/src/crypto_transform.c

+1
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ static bool read_submsg_header (tainted_input_buffer_t *input, uint8_t smid, Sub
333333

334334
// silly C can't deal with assignment to *submsg_view in any way because of endp
335335
// memcpy to the rescue!
336+
// coverity[store_writes_const_field]
336337
memcpy (submsg_view, &(tainted_input_buffer_t){ .ptr = input->ptr, .endp = input->ptr + hdr->octetsToNextHeader }, sizeof (*submsg_view));
337338
input->ptr += hdr->octetsToNextHeader;
338339
return true;

0 commit comments

Comments
 (0)
Please sign in to comment.