tcp: correct validity check return value