From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC40C4332F for ; Fri, 30 Dec 2022 04:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbiL3EVe (ORCPT ); Thu, 29 Dec 2022 23:21:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234024AbiL3EVO (ORCPT ); Thu, 29 Dec 2022 23:21:14 -0500 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C00F10FD for ; Thu, 29 Dec 2022 20:21:13 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E5B9C5C034B; Thu, 29 Dec 2022 23:21:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 29 Dec 2022 23:21:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672374072; x=1672460472; bh=av aCv9mDt906Bh4sj41n++Uvq9fM0k+OtKCj4mLejVk=; b=AdfnUSDcvhkNMT5qCO AGnXPlAaZOOHNImBd5bJ/NIwV2xgkd+58jc1AoriH5xNS6O3fRcoE6SNRuqLlxaC cK3q7xPoVNJ/o5hpxB1azDqdGxLQgPNxThdDaRbb+DyUP/DynwEuZEMKYpdsAAG5 PYMMGjVpK4SeMEkHZ9Sw7s30jbdUZOiJUuUNGaeD8PvSv8kNtDis/XU7D7endoJF BO0lhG9sD2t3Zj6TpS//5ramOMbnDMAoxhPBXe6aJHOTmSE/78l6fHrJAhnlIRqX iqq0GwF330APEiWRq5gb2p9SsJl46Ntwuwp04/9bm3vpH8hyKfwIOnvM84rx4ahx 2Ucg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672374072; x=1672460472; bh=avaCv9mDt906B h4sj41n++Uvq9fM0k+OtKCj4mLejVk=; b=ZbpGheFs815c1clpgDCXEJB+Kvsq2 78bKBhR5qE0TTh0YcJGHAK43gEupTOcCfHdBwBxzEEq+9VQ1Ff+HNH7Zzv6Ro7wT jlOXwTxq7aWnVRCGlQ5hsH53iHaPdHApDrqR5LKkAbGJTbKbkjZJHsILoECooYuf T3LbJe06dlYXy1k9J2UCo8FCjJbTVSYRfK659IuDx7/vKVEJEz2Pj8eR6NYsQQ0y MGu3U5OrfayvY4YNSknH2QIhe4AL37llflnp8sxXgPFggduMkGv5lDrM+8i3NYMV 2vVTNpBcYNTZEQZjiX7jI+zAS5cxAMpjnxa4LcRigjwF1CUg/BqOOw5eA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieehgdejtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdeftddmnecujfgurhephffvve fufffkofgjfhgggfestdekredtredttdenucfhrhhomheptfhushhsvghllhcuvehurhhr vgihuceorhhushgtuhhrsehruhhsshgvlhhlrdgttgeqnecuggftrfgrthhtvghrnhephf dvuefgtddvieeigefffeffkeeigedvgfeitdejteffveefhfdtheejffeiiedvnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhushgtuhhrse hruhhsshgvlhhlrdgttg X-ME-Proxy: Feedback-ID: i4421424f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 23:21:09 -0500 (EST) From: Russell Currey To: linuxppc-dev@lists.ozlabs.org Cc: gregkh@linuxfoundation.org, gcwilson@linux.ibm.com, linux-kernel@vger.kernel.org, nayna@linux.ibm.com, ajd@linux.ibm.com, zohar@linux.ibm.com, mpe@ellerman.id.au, Russell Currey Subject: [PATCH v2 2/7] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set Date: Fri, 30 Dec 2022 15:20:09 +1100 Message-Id: <20221230042014.154483-3-ruscur@russell.cc> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221230042014.154483-1-ruscur@russell.cc> References: <20221230042014.154483-1-ruscur@russell.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey --- arch/powerpc/kernel/secvar-ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/secvar-ops.c b/arch/powerpc/kernel/secvar-ops.c index 6a29777d6a2d..aa1b2adc2710 100644 --- a/arch/powerpc/kernel/secvar-ops.c +++ b/arch/powerpc/kernel/secvar-ops.c @@ -8,10 +8,12 @@ #include #include +#include -const struct secvar_operations *secvar_ops __ro_after_init; +const struct secvar_operations *secvar_ops __ro_after_init = NULL; void set_secvar_ops(const struct secvar_operations *ops) { + WARN_ON_ONCE(secvar_ops); secvar_ops = ops; } -- 2.38.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9201C4332F for ; Fri, 30 Dec 2022 04:23:56 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4NjsZz38Ytz3cGv for ; Fri, 30 Dec 2022 15:23:55 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.a=rsa-sha256 header.s=fm3 header.b=AdfnUSDc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm2 header.b=ZbpGheFs; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=russell.cc (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=ruscur@russell.cc; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.a=rsa-sha256 header.s=fm3 header.b=AdfnUSDc; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm2 header.b=ZbpGheFs; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4NjsWt6hrPz3c23 for ; Fri, 30 Dec 2022 15:21:14 +1100 (AEDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E5B9C5C034B; Thu, 29 Dec 2022 23:21:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 29 Dec 2022 23:21:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672374072; x=1672460472; bh=av aCv9mDt906Bh4sj41n++Uvq9fM0k+OtKCj4mLejVk=; b=AdfnUSDcvhkNMT5qCO AGnXPlAaZOOHNImBd5bJ/NIwV2xgkd+58jc1AoriH5xNS6O3fRcoE6SNRuqLlxaC cK3q7xPoVNJ/o5hpxB1azDqdGxLQgPNxThdDaRbb+DyUP/DynwEuZEMKYpdsAAG5 PYMMGjVpK4SeMEkHZ9Sw7s30jbdUZOiJUuUNGaeD8PvSv8kNtDis/XU7D7endoJF BO0lhG9sD2t3Zj6TpS//5ramOMbnDMAoxhPBXe6aJHOTmSE/78l6fHrJAhnlIRqX iqq0GwF330APEiWRq5gb2p9SsJl46Ntwuwp04/9bm3vpH8hyKfwIOnvM84rx4ahx 2Ucg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672374072; x=1672460472; bh=avaCv9mDt906B h4sj41n++Uvq9fM0k+OtKCj4mLejVk=; b=ZbpGheFs815c1clpgDCXEJB+Kvsq2 78bKBhR5qE0TTh0YcJGHAK43gEupTOcCfHdBwBxzEEq+9VQ1Ff+HNH7Zzv6Ro7wT jlOXwTxq7aWnVRCGlQ5hsH53iHaPdHApDrqR5LKkAbGJTbKbkjZJHsILoECooYuf T3LbJe06dlYXy1k9J2UCo8FCjJbTVSYRfK659IuDx7/vKVEJEz2Pj8eR6NYsQQ0y MGu3U5OrfayvY4YNSknH2QIhe4AL37llflnp8sxXgPFggduMkGv5lDrM+8i3NYMV 2vVTNpBcYNTZEQZjiX7jI+zAS5cxAMpjnxa4LcRigjwF1CUg/BqOOw5eA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieehgdejtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdeftddmnecujfgurhephffvve fufffkofgjfhgggfestdekredtredttdenucfhrhhomheptfhushhsvghllhcuvehurhhr vgihuceorhhushgtuhhrsehruhhsshgvlhhlrdgttgeqnecuggftrfgrthhtvghrnhephf dvuefgtddvieeigefffeffkeeigedvgfeitdejteffveefhfdtheejffeiiedvnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhushgtuhhrse hruhhsshgvlhhlrdgttg X-ME-Proxy: Feedback-ID: i4421424f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 23:21:09 -0500 (EST) From: Russell Currey To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/7] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set Date: Fri, 30 Dec 2022 15:20:09 +1100 Message-Id: <20221230042014.154483-3-ruscur@russell.cc> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221230042014.154483-1-ruscur@russell.cc> References: <20221230042014.154483-1-ruscur@russell.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ajd@linux.ibm.com, gregkh@linuxfoundation.org, nayna@linux.ibm.com, linux-kernel@vger.kernel.org, zohar@linux.ibm.com, Russell Currey , gcwilson@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey --- arch/powerpc/kernel/secvar-ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/secvar-ops.c b/arch/powerpc/kernel/secvar-ops.c index 6a29777d6a2d..aa1b2adc2710 100644 --- a/arch/powerpc/kernel/secvar-ops.c +++ b/arch/powerpc/kernel/secvar-ops.c @@ -8,10 +8,12 @@ #include #include +#include -const struct secvar_operations *secvar_ops __ro_after_init; +const struct secvar_operations *secvar_ops __ro_after_init = NULL; void set_secvar_ops(const struct secvar_operations *ops) { + WARN_ON_ONCE(secvar_ops); secvar_ops = ops; } -- 2.38.1