From nobody Thu Feb 02 21:11:52 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P7BLK0PnWz3kb55; Thu, 2 Feb 2023 21:11:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P7BLJ711Cz3DNv; Thu, 2 Feb 2023 21:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675372313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XTXDWnjpCjtMtLTkP2cyraEcT9S6e2HrysOgO+MUigY=; b=YOisT6EB7+7jKbvte6yiyZtlS4ZxNCwKQJRol+pUvvRdutRCZLgrIqLzSlXpyGpEy/dXid YB4Tp2UQMaXnQK1JKHzAT0piwVY0r1I5f1t2DfKMBEZ0uovMd2TohfZFZ9MH54/sXKCF6z TTTOMlLN9q/Hbv6z3L7whkY5XJW8yZBCZmmTlJGwlxlPam+SY/eQkJyJ7+kdDqfnKxisQB x9/uRoD5SWESeCJJ1gv7pCVal1SdZgaSK5tEIpVW3PCz85P1bvoI6GQBE9HNS6q3x0oIUD XVhvafrAnF2lEto2Kf2ujMzvjkL+J290QoLzxA6g4vg/7UlILGNNNZvteqdLIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675372313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XTXDWnjpCjtMtLTkP2cyraEcT9S6e2HrysOgO+MUigY=; b=Xq8vKAb2c/R3q4X2LfQciqOPD4BHuNpniM8XeaU8Sbn8u/GP+gJ0pcK5x1/PGip6fUF/vS X1EfWJrtCZdgRkoIPi2JNKWXJGkc5TUi56/iVkoy7SRByuBI6qwT0y9ZOKso3ucxVcm4QV KwelR7A/J65elMDe8+ujtto0MGbqbrLkv+Y5vfWshMmiM9fbjjLFEYlGdyDwcoUl7G71+v qaOTeeouG5LmHRZB7VqbDTs+A4amUqtMatqxRM446d1lrmjv5mXS4qkI45n6xggSRWrlSK n/crI8x+IOiBg2KrfhSMb2G2g6o+Cd/WZ5tzGrtm6lYDJ+E8hZ1UILk7RIJtjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675372313; a=rsa-sha256; cv=none; b=jF4jtp10HbyhJfreCbaBmDj8AIwLG82d7ca3VpfT8pYst+R5vTW+Ediq/zN8ZPnJEyEy5E 85boxLyqJYJ1GLIM9BTooW1NJ4k4zdcELQi9+B49+I15Qo4JDNr6d1r9EA8B93LM25jrCo qx46TXzAL6U0zxRoMm8nBX+TyHbFT9wCtQE/HtMQLEWyM4//26J77UGGZg0ZeYVh0pg7Tu mwFUHnE18lSxfq0vaTWB+RIa8k6JlLdzJ+hUAKGMLIBthswCDRwCFmuK+tJkRFHgpfxjrX lo3mBNiZO/wGbhdetLsR+VJTb2Eggz16UxAo61R4T5PNHUsURXYelwiTbKF8Cg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P7BLJ5ykFz18JK; Thu, 2 Feb 2023 21:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 312LBq3N033942; Thu, 2 Feb 2023 21:11:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 312LBqAc033941; Thu, 2 Feb 2023 21:11:52 GMT (envelope-from git) Date: Thu, 2 Feb 2023 21:11:52 GMT Message-Id: <202302022111.312LBqAc033941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 63c7a483e552 - main - kboot: Assert errno is negative List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63c7a483e55274a824e564e308215cc0f0aee6aa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=63c7a483e55274a824e564e308215cc0f0aee6aa commit 63c7a483e55274a824e564e308215cc0f0aee6aa Author: Warner Losh AuthorDate: 2023-02-02 21:08:03 +0000 Commit: Warner Losh CommitDate: 2023-02-02 21:09:55 +0000 kboot: Assert errno is negative When converting from a Linux error to a FreeBSD errno, assert that the value passed in is negative, as is Linux's custom. Suggested by: brooks Sponsored by: Netflix Reviewed by: tsoome, brooks Differential Revision: https://reviews.freebsd.org/D38357 --- stand/kboot/host_syscall.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 75394afcde6c..64288f48e6f0 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -29,6 +29,7 @@ #define _HOST_SYSCALL_H #include +#include long host_syscall(int number, ...); @@ -214,6 +215,12 @@ ssize_t host_write(int fd, const void *buf, size_t nbyte); * function where -1 to -34 are translated to 1 to 34 and all others are EINVAL. * Pass the linux return value, which will be the -errno. */ -#define host_to_stand_errno(e) ((-e) > 34 ? EINVAL : (-e)) +static __inline int +host_to_stand_errno(int e) +{ + assert(e < 0); + + return((-e) > 34 ? EINVAL : (-e)); +} #endif