Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/interval-tree: fix coverity warning #10593

Closed
wants to merge 1 commit into from

Conversation

inashivb
Copy link
Member

@inashivb inashivb commented Mar 8, 2024

Fix Coverity warning

** CID 1592992:  Incorrect expression  (COPY_PASTE_ERROR)
/src/util-port-interval-tree.c: 255 in SCPortIntervalFindOverlaps()

________________________________________________________________________________________________________
*** CID 1592992:  Incorrect expression  (COPY_PASTE_ERROR)
/src/util-port-interval-tree.c: 255 in SCPortIntervalFindOverlaps()
249                      * will be sorted, insert any new ports to the end of the list
250                      * and avoid walking the entire list */
251                     if (*list == NULL) {
252                         *list = new_port;
253                         (*list)->last = new_port;
254                     } else if (((*list)->last->port != new_port->port) &&
>>>     CID 1592992:  Incorrect expression  (COPY_PASTE_ERROR)
>>>     "port" in "(*list)->last->port2 != new_port->port" looks like a copy-paste error.
255                                ((*list)->last->port2 != new_port->port)) {
256                         DEBUG_VALIDATE_BUG_ON(new_port->port < (*list)->last->port);
257                         (*list)->last->next = new_port;
258                         new_port->prev = (*list)->last;
259                         (*list)->last = new_port;
260                     } else {

The code does not generate two port ranges that are same other than the
cases where port == port2 which is why it worked so far. Fix it.

Bug 6839
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.73%. Comparing base (f9cf87a) to head (75b41ea).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #10593       +/-   ##
===========================================
+ Coverage   64.07%   82.73%   +18.65%     
===========================================
  Files         851      924       +73     
  Lines      135327   247447   +112120     
===========================================
+ Hits        86716   204721   +118005     
+ Misses      48611    42726     -5885     
Flag Coverage Δ
fuzzcorpus 64.15% <100.00%> (+0.07%) ⬆️
suricata-verify 61.87% <100.00%> (?)
unittests 62.20% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@victorjulien
Copy link
Member

Are the load times affected by this change?

@inashivb
Copy link
Member Author

inashivb commented Mar 8, 2024

Are the load times affected by this change?

No. Following is the fresh result on my system.
This PR

real	0m29.687s
user	0m29.226s
sys	0m0.409s

vs master

real	0m29.843s
user	0m29.343s
sys	0m0.426s

@inashivb inashivb marked this pull request as ready for review March 8, 2024 11:34
@victorjulien
Copy link
Member

Are the load times affected by this change?

No. Following is the result on my system.

real	0m29.593s
user	0m29.024s
sys	0m0.506s

How does it compare to w/o the fix?

@inashivb
Copy link
Member Author

inashivb commented Mar 8, 2024

How does it compare to w/o the fix?

Apologies. Please check the updated comment above with fresh results off my system.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 19084

@victorjulien victorjulien added this to the 8.0 milestone Mar 8, 2024
@victorjulien
Copy link
Member

Merged in #10600, thanks!

@inashivb inashivb deleted the minor-codecov/v1 branch March 11, 2024 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants