From nobody Wed Dec 08 18:47:26 2021 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 1A21218C85E1; Wed, 8 Dec 2021 18:47:27 +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 4J8R3y5cXWz3G57; Wed, 8 Dec 2021 18:47:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 93CE618780; Wed, 8 Dec 2021 18:47:26 +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 1B8IlQD3010711; Wed, 8 Dec 2021 18:47:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B8IlQ2C010710; Wed, 8 Dec 2021 18:47:26 GMT (envelope-from git) Date: Wed, 8 Dec 2021 18:47:26 GMT Message-Id: <202112081847.1B8IlQ2C010710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: adb12675055f - main - syscall_args: remove MAXARGS define 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: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adb12675055fb7114f50f8e809f68ed316fb8ec4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638989246; 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=9VJCgsX0M914Qd8LWgnjS6R2GjBvz8ZCCo5L8ja+eJQ=; b=xpti9CG8KVuReB1DU5awZgxM1eOiZxQI1DYOZFjxyDjuY46MbdxXMJAfPXgLM00TwA1WyR drvi1jXx/I5btTK+nnIGMjq8ebv855c4mm4uz+lV6yI6roxIi4YBOtXUg6AuYEXrNX+Oz5 JOQhbA3ahOckfhGBcp1GSh2naxt8RiwBeGBB12T8nU/5wCS0JiXi080nniPGk9sjcz6JPW pWZNgG+ZRWPWYiWLLwCg9PS4ctUwJbcDwfRfZauFmXEAPHj+HWN+PML9wIDWbZIkqSUlgZ yNDFdwTufpVoajz1MZ50TTCSjNniGzOoj5xZAjKv8No1BnUnhTQyN5Jekh7jfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638989246; a=rsa-sha256; cv=none; b=Zk+3pVBAOjxruDXw+/esYVUN1O1eiBfQNpEWZvA8qVyI4VfALYESgYCpnH6b5gLHOnZSwC EmUw9jb7rEeR/VM25/TuHsdekjshqL4agCyOW/uzIzGjkovwum89GoNExwsDh6dToQO3Qo r4DoldcEN4Ka5J9SDvkRO6ez3kQUaKusk9gbuGKZohh5vGBFK1Cz8w43W/3YNkTxJqQrmZ 15pYylPiHmGnuCYzDlTOOXsrfDKbRUvtJqFgaB37b15USBVMRMyC6gGlk6RoBH9PJsmtRK DegG+cSnK+utX/npZrygth9sWa9KFQ+z5QkJO9CdhepMB9IaOiLJ3kfeyiLepw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=adb12675055fb7114f50f8e809f68ed316fb8ec4 commit adb12675055fb7114f50f8e809f68ed316fb8ec4 Author: Brooks Davis AuthorDate: 2021-12-08 18:45:15 +0000 Commit: Brooks Davis CommitDate: 2021-12-08 18:45:41 +0000 syscall_args: remove MAXARGS define Use nitems instead and just use a magic `8` for the size of the args array. MAXARGS was rarely used (only in arm64 code) and is an overly generic name to polute the namespace with. Requested by: kib in D33308 --- sys/arm64/arm64/trap.c | 2 +- sys/arm64/linux/linux_sysvec.c | 7 ++++--- sys/sys/proc.h | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 891f1024232a..2b357d723e15 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -159,7 +159,7 @@ cpu_fetch_syscall_args(struct thread *td) KASSERT(sa->callp->sy_narg <= nitems(sa->args), ("Syscall %d takes too many arguments", sa->code)); - memcpy(dst_ap, ap, (MAXARGS - 1) * sizeof(register_t)); + memcpy(dst_ap, ap, (nitems(sa->args) - 1) * sizeof(register_t)); td->td_retval[0] = 0; td->td_retval[1] = 0; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index c88442a19c53..a63c82b38c73 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -160,9 +160,10 @@ linux_fetch_syscall_args(struct thread *td) else sa->callp = &p->p_sysent->sv_table[sa->code]; - if (sa->callp->sy_narg > MAXARGS) - panic("ARM64TODO: Could we have more than %d args?", MAXARGS); - memcpy(sa->args, ap, MAXARGS * sizeof(register_t)); + if (sa->callp->sy_narg > nitems(sa->args)) + panic("ARM64TODO: Could we have more than %zu args?", + nitems(sa->args)); + memcpy(sa->args, ap, nitems(sa->args) * sizeof(register_t)); td->td_retval[0] = 0; return (0); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f448c8a9d104..ff97bfbd54a9 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -201,12 +201,11 @@ struct vm_map; struct vm_map_entry; struct epoch_tracker; -#define MAXARGS 8 struct syscall_args { u_int code; u_int original_code; struct sysent *callp; - register_t args[MAXARGS]; + register_t args[8]; }; /*