Remove linuxerr.IsValid and use syserr.IsValid instead.

linuxerr.IsValid just checks if the errno is less than the max possible errno
value. syserr.IsValid additionally checks if the errno can be translated by the
syserr package.

Furthermore, drop the usage of linuxerr.TranslateError(), which only checks
against a map with 3 entries of sentry-internal errors. Earlier, connError()
would always fail at this step and end up returning linuxerr.EINVAL even if the
errno being returned is valid.

Reported-by: syzbot+180b8537798c091bf9fd@syzkaller.appspotmail.com
PiperOrigin-RevId: 680021716
This commit is contained in:
Ayush Ranjan
2024-09-28 12:34:57 -07:00
committed by gVisor bot
parent 0760a3df59
commit 3971ecbc6c
8 changed files with 39 additions and 27 deletions
-5
View File
@@ -366,8 +366,3 @@ func Equals(e *errors.Error, err error) bool {
}
return e == err || unixErr == err
}
// IsValid returns whether err is a valid error number.
func IsValid(errno unix.Errno) bool {
return errno < unix.Errno(maxErrno)
}