From nobody Tue Jan 24 08:54:09 2023 X-Original-To: dev-commits-src-branches@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 4P1LPG0hhQz30x81; Tue, 24 Jan 2023 08:54:10 +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 4P1LPG01xrz3RLl; Tue, 24 Jan 2023 08:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674550450; 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=x5lcv72oNLJmq64tTTpWiozPJbx68B8wB+bUU1T0CFU=; b=YpVrz9Q2x5HmqmKSJvieSQBaVcXpZD8TJ5gAB7vJVyXEQjzJt97iz5dZwz0M/KrFRDVBnE jLvMs1QA6XLOEDuHU+rTMWvIWF+9crgt2xQDD4Z3NCK9bUeWTQlAvnRQGUQXOLsxC/e4ZJ QKbI4PdvMZTOWBdZUracStjd7zitCAQf0HgH7C6fmujvZ/zMxtO1f1WjO8/7ZIhCFiJrlt RXaQzopZM1WtXTb6+RW8vwshoL5ueJygOygc8ZIyNVtHIVt6yr6YYmkCwANt5zjKeGMWx5 fQv8To3pPzkKUvOLAAqoA5Zi933AV5rfTyp0Y69LGRRSOpE5LVFVf/A2r55JZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674550450; 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=x5lcv72oNLJmq64tTTpWiozPJbx68B8wB+bUU1T0CFU=; b=NgvIr7GMFcfgla2nxrjboTufU+g5YxqJY1p9Pz3XnoXyoY69djXbkqrNLzA2bTna0H/mNG EAC2iulOP0xWA0oPef2zsSIP0YFWCNQ30ghYTMl+Wuavo6KF91g+6RxKQhLrc0XpaBM/JX /vyNLynuxGGLMC5ZAqGUsmFOJlj9fryX6Rc+6pdrox1zdYiH4y4bfeVNMcIadhXNRhnXKx aXfzhQ+Ssj2WNpdAloCa2wNQJRji7VO0O8wMA/h/v2b3muMuRs+jjFJcpaNi2TGJ5Fn9LZ ouVOhuoL5FSFdyiNbgmTXFxMDsD9BFQ+ZQZ9OJOamw2uSMeMbotTUR3dmZze5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674550450; a=rsa-sha256; cv=none; b=ldQMc8FKurQZezebaV4yu9+QGbo89rhY+D2YHHD5UtUwVVcvZnE3unnexOxIu3Gq9J/Llv Cs1zW3otn8M+ksxI34wpJF2cluyJucY5Og7g/+far8SP5CGgNl3rSTl0KWYWj2wlYQDWzo EOlXFfaRiXeDCLg2X2QzcZym1ENAI18+CcThe5xKHTmMI2AIVK02rjvVJTUz03evfrQWtR 4UWmrMUbFCODU7eS5sBPjvMQRsLxk3wqrbL76k/oGy93unTw5Qs2QCtrmUzyRYjIhp+Bur JygSPXJCX+EbLZPwp/ujep4f/MiJVpQCtdw7H2CL1OaYrOG1p8jv4ya37CBUBw== 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 4P1LPF66bzz13Dx; Tue, 24 Jan 2023 08:54:09 +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 30O8s9nQ036126; Tue, 24 Jan 2023 08:54:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30O8s9Tq036125; Tue, 24 Jan 2023 08:54:09 GMT (envelope-from git) Date: Tue, 24 Jan 2023 08:54:09 GMT Message-Id: <202301240854.30O8s9Tq036125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 0ce099e9e391 - stable/13 - linuxkpi: Define `ZERO_OR_NULL_PTR()` in List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ce099e9e39154a53689fcd8e3cc06d8b67a2088 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0ce099e9e39154a53689fcd8e3cc06d8b67a2088 commit 0ce099e9e39154a53689fcd8e3cc06d8b67a2088 Author: Jean-Sébastien Pédron AuthorDate: 2022-11-11 20:03:25 +0000 Commit: Emmanuel Vadot CommitDate: 2023-01-24 09:08:01 +0000 linuxkpi: Define `ZERO_OR_NULL_PTR()` in On Linux, the `kmalloc()` family of functions returns a special value if the size of the allocation is zero. This macro verifies if the pointer is NULL (the allocation failed) or the size is 0 (the allocation was not performed AFAIU). This special value can be passed to `kfree()`. On FreeBSD, our `malloc(9)` functions don't return a special value for 0-size allocations. Therefore we can simply compare the result against NULL. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D37367 (cherry picked from commit 208d02fd5d165389aed0c2b60519cb6b0f5b89f9) --- sys/compat/linuxkpi/common/include/linux/slab.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index d76b376c01a2..131c7c417649 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -90,6 +90,8 @@ struct linux_kmem_cache; /* drm-kmod 5.4 compat */ #define kfree_async(ptr) kfree(ptr); +#define ZERO_OR_NULL_PTR(x) ((x) == NULL) + static inline gfp_t linux_check_m_flags(gfp_t flags) {