Skip to content

Conversation

@svc-rdkeportal01
Copy link

Issue Fixed

Coverity Defect: DEADCODE
CWE: CWE-561 (Dead Code)
Severity: Medium
Function: hints
File: utils/rbuscli/rbuscli.c

Root Cause

The function hints has two else if conditions checking for the same value, making the second one unreachable dead code.

The second else if can never be reached because if num equals 3, the first condition will always catch it first.

Changes Made

Changed the second condition from num == 3 to num == 4 to make it reachable and handle the 4-token case properly.

Why This Fix is Correct

  1. Removes dead code - The second condition can now be reached when num == 4
  2. Logical progression - Conditions now check num == 2, num == 3, num == 4
  3. Proper hint handling - Provides hints for 4-token commands
  4. Simple fix - Just change 3 to 4

Testing

  • Verified fix compiles without errors
  • Checked that the condition sequence is now logical
  • Confirmed no other dead code remains

The function hints has two 'else if(num == 3)' conditions in sequence.
The second one can never be reached because the first one will always
catch num == 3 first, making the second condition dead code.

The second condition should be 'else if(num == 4)' to handle the case
when there are 4 tokens.

Coverity: DEADCODE
CWE-561: Dead Code
@svc-rdkeportal01 svc-rdkeportal01 requested a review from a team as a code owner December 4, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant