From nobody Fri Nov 11 20:05:07 2022 X-Original-To: dev-commits-src-main@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 4N88nc2Tb4z4fs3l; Fri, 11 Nov 2022 20:05:08 +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 4N88nc17WFz4K3M; Fri, 11 Nov 2022 20:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668197108; 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=SGLLbCcoYqpd3JXowM91kbpbp3bxDQZZVbyUJkDXly4=; b=Ezdcfuqisk3fKwB2p8ehXyQSnSO/f06yQ5qHJ+ZDAs8J9aQCZiUGtNFg90JK0M9R6hDlkq cOojZbfZlwLNoTrnWN/FQcrHcQyKgy7Tpr9yQF61aYuFQ4oFI/VcYUCPVGDl0vcwLI3Sq4 PwsCXjyoZxE35i+/43onmlDDVDs16caJnqhuY/dhiLeBA4AUfQqbfNDraALta6V9eFzMZA kG383zxaZm1glTlRulra5KqPA93ZC5uOZfZkXrWI+QI9mnP8Iv1aTyojUjMovNn1EhtEvV eLSOgPKoFycQWmfpjwUiHSqadI9NhDI+zEutk1LD6Oieq+Aqv5qEwtVpdZMkmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668197108; 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=SGLLbCcoYqpd3JXowM91kbpbp3bxDQZZVbyUJkDXly4=; b=LhalxtStU3Sej4vfcmi9rniQBHHa+1T93pWUwtzJ4KItcK729ZsJlO5PPedTpIsWitIwmH gzPRhX9GpmmZVRPare2mHjA8hZuuVzvGbQmggirftaf0sfuszIHb8gDXWPaxP3Opytm1xj wutBL1qwE9Ht54bML+5RBTFAo4A1KYtqiXi7q0WzTzNIbpTnem12z8mDfLq6ImrOrxrDhW AJIRBdFThv8UIoxXicJiKO4SL/ZFesgIjtHciB96FNjmfEF8J3I4TfFXELGxzn5uGHtnaM /lo/S8vkBjPuS0HbJ47hus0PNHVDPxafc17K31Y0nggaZhBK72LMFZfvVCFqkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668197108; a=rsa-sha256; cv=none; b=tYvsBhIM1ehxDNCB2OIUXaKFnZqofl5dTLyOvz41BZt/Q6hEs3kJU/GZ8lmfw+PtD4MeT8 TDtlD/VGG6MSdaZ1jtPc2HASiiUPUcZYNaG8vmZVb+8G/i6sxlkEUM70yFXOg+3T9lmJ3/ ad8JprNFOePRDVyzfsiVkOu283a9HRTd0O+6FMcKexgw81+TVpogBwYA2OEMhouTFpvxaj Zja3/6UKeS/h9RJLXjyynTWvYhFna7URSyF+LUUIjXUeVyfQVqOOgCv0QNVNA9GrxOT/Wp f7g4QKXqbWrWktWDlmQIna5ChjnBEu21dxx7XT8i0lvbUW+tVFJKhFZOunH4JQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N88nc08SXzwBH; Fri, 11 Nov 2022 20:05:08 +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 2ABK57tJ033842; Fri, 11 Nov 2022 20:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABK57of033840; Fri, 11 Nov 2022 20:05:07 GMT (envelope-from git) Date: Fri, 11 Nov 2022 20:05:07 GMT Message-Id: <202211112005.2ABK57of033840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 208d02fd5d16 - main - linuxkpi: Define `ZERO_OR_NULL_PTR()` in List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 208d02fd5d165389aed0c2b60519cb6b0f5b89f9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=208d02fd5d165389aed0c2b60519cb6b0f5b89f9 commit 208d02fd5d165389aed0c2b60519cb6b0f5b89f9 Author: Jean-Sébastien Pédron AuthorDate: 2022-11-11 20:03:25 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2022-11-11 20:03:25 +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 --- 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 8f1cb433c36b..915f33acf67e 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) {