Change in osmo-pcu[master]: rlc: Fix memset(0) on object with no trivial copy-assignment

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed May 16 13:23:21 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/9201


Change subject: rlc: Fix memset(0) on object with no trivial copy-assignment
......................................................................

rlc: Fix memset(0) on object with no trivial copy-assignment

As warned by gcc 8.1.0, the cs field is a class (GprsCodingScheme) and
should not be memset.

Change-Id: Id742f82aa856e696b5fb414991dfd0883d0ac7fe
---
M src/rlc.cpp
1 file changed, 10 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/01/9201/1

diff --git a/src/rlc.cpp b/src/rlc.cpp
index a82f550..ee88bd9 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -326,11 +326,18 @@
 	unsigned int i;
 	unsigned int padding_bits = with_padding ? cs.optionalPaddingBits() : 0;
 
-	memset(rlc, 0, sizeof(*rlc));
-
 	rlc->cs = cs;
-	rlc->with_padding = with_padding;
+	rlc->r = 0;
+	rlc->si = 0;
+	rlc->tfi = 0;
+	rlc->cps = 0;
+	rlc->rsb = 0;
+	rlc->usf = 0;
+	rlc->es_p = 0;
+	rlc->rrbp = 0;
+	rlc->pr = 0;
 	rlc->num_data_blocks = cs.numDataBlocks();
+	rlc->with_padding = with_padding;
 
 	OSMO_ASSERT(rlc->num_data_blocks <= ARRAY_SIZE(rlc->block_info));
 

-- 
To view, visit https://gerrit.osmocom.org/9201
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id742f82aa856e696b5fb414991dfd0883d0ac7fe
Gerrit-Change-Number: 9201
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180516/dac45bfe/attachment.htm>


More information about the gerrit-log mailing list