https://bugs.linaro.org/show_bug.cgi?id=1344
Bug ID: 1344
Summary: CID 87295: Improper use of negative value:
odp_classification_basic.c
Product: OpenDataPlane
Version: 1.0
Hardware: Other
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: ---
Component: Classification
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
63static void classification_destroy_pmr(void)
64{
65 odp_pmr_t pmr;
66 uint16_t val;
67 uint16_t mask;
68 int retval;
69 val = 1024;
70 mask = 0xffff;
71 pmr = odp_pmr_create_match(ODP_PMR_TCP_SPORT, &val, &mask,
sizeof(val));
72 retval = odp_pmr_destroy(pmr);
73 CU_ASSERT(retval == 0);
CID 87295 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
negative_returns: Passing negative constant (odp_pmr_t)0xffffffffffffffff to a
parameter that cannot be negative. [show details]
74 retval = odp_pmr_destroy(ODP_PMR_INVAL);
75 retval = odp_pmr_destroy(ODP_PMR_INVAL);
76 CU_ASSERT(retval < 0);
77}
/platform/linux-generic/odp_classification.c
473int odp_pmr_destroy(odp_pmr_t pmr_id)
474{
1. index: Function get_pmr_entry uses pmr_id as an array index. [show
details]
475 pmr_t *pmr = get_pmr_entry(pmr_id);
476
477 if (pmr == NULL)
478 return -1;
479 pmr->s.valid = 0;
480 return 0;
481}
/platform/linux-generic/odp_classification.c
246pmr_t *get_pmr_entry(odp_pmr_t pmr_id)
247{
1. Condition (uint32_t)(uintptr_t)pmr_id >= 64, taking false branch
2. Condition pmr_id == (odp_pmr_t)0xffffffffffffffff, taking false
branch
248 if (_odp_typeval(pmr_id) >= ODP_PMR_MAX_ENTRY ||
249 pmr_id == ODP_PMR_INVAL)
250 return NULL;
3. index: Indexing pmr_tbl->pmr with pmr_id.
251 if (pmr_tbl->pmr[_odp_typeval(pmr_id)].s.valid == 0)
252 return NULL;
253 return &(pmr_tbl->pmr[_odp_typeval(pmr_id)]);
254}
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp