074262f6c1
Checking for the cdesc not being NULL doesn't have any sense if the idx argument is not 0, so it can be skipped, as the error won't be detected anyway. To simplify that, only the 'i' value is being verified and the code is breaking from the infinite loop in case when all descriptors were copied into the buffer. Signed-off-by: Michal Krawczyk <mk@semihalf.com> Reviewed-by: Igor Chauskin <igorch@amazon.com> Reviewed-by: Guy Tzalik <gtzalik@amazon.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>