]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
if_media.c SIOCGMEDIAX handler: improve loop
authorkib <kib@FreeBSD.org>
Tue, 3 Nov 2020 14:33:04 +0000 (14:33 +0000)
committerkib <kib@FreeBSD.org>
Tue, 3 Nov 2020 14:33:04 +0000 (14:33 +0000)
commit10e690b2b1d73537456375fca9a800ced94d825c
tree7aec79a6ed921051f762640ecfe118c2f7bfb88f
parent6e010a388a4fc54f36c47df609f40974749d7fd5
if_media.c SIOCGMEDIAX handler: improve loop

Stop advancing counter past the current iteration number at the start
of iteration.  This removes the need of subtracting one when
calculating index for copyout, and arguably fixes off-by-one reporting
of copied out elements when copyout failed.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies / NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27073
sys/net/if_media.c