Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #29805

41 coverity defects on prob_distr.c

The DIST_BASE_TYPED macro in prob_distr.h is causing us 41 new coverity defects. I don't think it's wrong but it's quite hacky so we should fix it in some way.

*** CID 1444029:  Incorrect expression  (SIZEOF_MISMATCH)
/src/lib/math/prob_distr.c: 1511 in log_logistic_sf()
1505       return cdf_log_logistic(x, LL->alpha, LL->beta);
1506     }
1507     
1508     static double
1509     log_logistic_sf(const struct dist *dist, double x)
1510     {
>>>     CID 1444029:  Incorrect expression  (SIZEOF_MISMATCH)
>>>     Adding "0UL /* 0 * sizeof (dist - &((struct log_logistic const *)((char const *)dist - __builtin_offsetof()))->base) */" to pointer
>>> "(struct log_logistic const *)((char const *)dist - 0UL)" of type "struct log_logistic const *" is suspicious because adding an integral value
>>> to this pointer automatically scales that value by the size, 24 bytes, of the pointed-to type, "struct log_logistic const".  Most likely, the
>>> multiplication by "sizeof (dist - &((struct log_logistic const *)((char const *)dist - 0UL))->base)" in this expression is extraneous and
>>> should be eliminated.
1511       const struct log_logistic *LL = const_container_of(dist,
1512         struct log_logistic, base);
1513     
1514       return sf_log_logistic(x, LL->alpha, LL->beta);
1515     }
1516     
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking