osmo-pcu[master]: Sanitizer fix for invalid value of egprs_puncturing_values

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jan 12 22:27:11 UTC 2017


Patch Set 4: Code-Review-2

(2 comments)

we're not making any progress here. It would be less work for me to fix it myself than reiterating the same reviews on half-baked efforts.

Would you please for once verify the code that you're writing. Observe the results of this trivial test program that shows what happens with your choice of initialization for two enum values:

  #include <stdio.h>
  #include <string.h>

  enum myvals {
    FOO, BAR, BAZ
  };

  int main(void)
  {
    enum myvals vals[2];
  
    memset(vals, BAR, sizeof(vals));
  
    printf("sizeof: %zu\n", sizeof(vals));
    printf("0: %d\n", vals[0]);
    printf("1: %d\n", vals[1]);
    return 0;
  }

https://gerrit.osmocom.org/#/c/1411/4/src/tbf_dl.cpp
File src/tbf_dl.cpp:

Line 636: 	memset(punct, EGPRS_PS_INVALID, sizeof(punct));
memset is useful only for values of 8 bit size.
enum egprs_puncturing_values is possibly an int and this will not work.


Line 771: 		rlc.cps = gprs_rlc_mcs_cps(cs, punct[0], punct[1], need_padding);
I don't see how this relates to my comments at all. Would you explain please?


-- 
To view, visit https://gerrit.osmocom.org/1411
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice54edc7e4a936eb2f2dd8a243673a30dceef542
Gerrit-PatchSet: 4
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: arvind.sirsikar <arvind.sirsikar at radisys.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: arvind.sirsikar <arvind.sirsikar at radisys.com>
Gerrit-HasComments: Yes


More information about the gerrit-log mailing list