Skip to content

Commit d39671b

Browse files
ethancedwards8NipaLocal
authored andcommitted
octeontx2-af: Fix uninitialized scalar variable
The variable *max_mtu* is uninitialized in the function otx2_get_max_mtu. It is only assigned in the if-statement, leaving the possibility of returning an uninitialized value. 1500 is the industry standard networking mtu and therefore should be the default. If the function detects that the hardware custom sets the mtu, then it will use it instead. Addresses-Coverity-ID: 1636407 ("Uninitialized scalar variable") Fixes: ab58a41 ("octeontx2-pf: cn10k: Get max mtu supported from admin function") Signed-off-by: Ethan Carter Edwards <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent ae8fb74 commit d39671b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)
19091909
{
19101910
struct nix_hw_info *rsp;
19111911
struct msg_req *req;
1912-
u16 max_mtu;
1912+
u16 max_mtu = 1500;
19131913
int rc;
19141914

19151915
mutex_lock(&pfvf->mbox.lock);
@@ -1948,7 +1948,6 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)
19481948
if (rc) {
19491949
dev_warn(pfvf->dev,
19501950
"Failed to get MTU from hardware setting default value(1500)\n");
1951-
max_mtu = 1500;
19521951
}
19531952
return max_mtu;
19541953
}

0 commit comments

Comments
 (0)