mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 20:42:49 +00:00
coverity: get_service_fd() is passed to a parameter that cannot be negative
criu/fdstore.c:110: negative_return_fn: Function "get_service_fd(FDSTORE_SK_OFF)" returns a negative number. criu/fdstore.c:110: assign: Assigning: "sk" = "get_service_fd(FDSTORE_SK_OFF)". criu/fdstore.c:114: negative_returns: "sk" is passed to a parameter that cannot be negative. criu/namespaces.c:1366: negative_return_fn: Function "get_service_fd(USERNSD_SK)" returns a negative number. criu/namespaces.c:1366: assign: Assigning: "sk" = "get_service_fd(USERNSD_SK)". criu/namespaces.c:1389: negative_returns: "sk" is passed to a parameter that cannot be negative. Signed-off-by: Adrian Reber <areber@redhat.com> Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
parent
6ff51fd8d3
commit
c405a01166
2 changed files with 11 additions and 2 deletions
|
|
@ -107,8 +107,13 @@ int fdstore_add(int fd)
|
|||
|
||||
int fdstore_get(int id)
|
||||
{
|
||||
int sk = get_service_fd(FDSTORE_SK_OFF);
|
||||
int fd;
|
||||
int sk, fd;
|
||||
|
||||
sk = get_service_fd(FDSTORE_SK_OFF);
|
||||
if (sk < 0) {
|
||||
pr_err("Cannot get FDSTORE_SK_OFF fd\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
mutex_lock(&desc->lock);
|
||||
if (setsockopt(sk, SOL_SOCKET, SO_PEEK_OFF, &id, sizeof(id))) {
|
||||
|
|
|
|||
|
|
@ -1364,6 +1364,10 @@ int __userns_call(const char *func_name, uns_call_t call, int flags,
|
|||
return call(arg, fd, getpid());
|
||||
|
||||
sk = get_service_fd(USERNSD_SK);
|
||||
if (sk < 0) {
|
||||
pr_err("Cannot get USERNSD_SK fd\n");
|
||||
return -1;
|
||||
}
|
||||
pr_debug("uns: calling %s (%d, %x)\n", func_name, fd, flags);
|
||||
|
||||
if (!async)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue