Skip to content

Commit

Permalink
net: ppp: ipcp: Remove dead code
Browse files Browse the repository at this point in the history
If nack_idx > 0, then the count_rej must be > 0. This means that
the "code" variable will never be set to PPP_CONFIGURE_NACK.

Fixes zephyrproject-rtos#22436
Coverity-CID: 207975

Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar committed Feb 12, 2020
1 parent 08a3985 commit b807022
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions subsys/net/l2/ppp/ipcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
u16_t length,
struct net_buf **ret_buf)
{
int nack_idx = 0, count_rej = 0, address_option_idx = -1;
int nack_idx = 0, address_option_idx = -1;
struct net_buf *buf = NULL;
struct ppp_option_pkt options[MAX_IPCP_OPTIONS];
struct ppp_option_pkt nack_options[MAX_IPCP_OPTIONS];
Expand Down Expand Up @@ -120,7 +120,6 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
break;

default:
count_rej++;
nack_options[nack_idx].type.ipcp =
options[i].type.ipcp;
nack_options[nack_idx].len = options[i].len;
Expand All @@ -139,11 +138,7 @@ static int ipcp_config_info_req(struct ppp_fsm *fsm,
if (nack_idx > 0) {
struct net_buf *nack_buf;

if (count_rej > 0) {
code = PPP_CONFIGURE_REJ;
} else {
code = PPP_CONFIGURE_NACK;
}
code = PPP_CONFIGURE_REJ;

/* Create net_buf containing options that are not accepted */
for (i = 0; i < MIN(nack_idx, ARRAY_SIZE(nack_options)); i++) {
Expand Down

0 comments on commit b807022

Please sign in to comment.