net: gptp: Fix for coverity CIDs 203471 and 203464

If no challenger went to replace the best port/vector, then the best
port is still the global_ds and thus point to the same memory: no need
to update the global_ds then.

Coverity-CID: 203471
Coverity-CID: 203464
Fixes #18395

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-08-22 13:29:15 +02:00 committed by Anas Nashif
parent 82c315aaf5
commit 112ecb7290

View File

@ -1615,7 +1615,7 @@ static int compute_best_vector(void)
}
}
if (best_port != 0) {
if ((best_port != 0) && (best_vector != gm_prio)) {
memcpy(&global_ds->gm_priority.root_system_id,
&best_vector->root_system_id,
sizeof(struct gptp_root_system_identity));