Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp253540rwb; Wed, 18 Jan 2023 17:14:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXufZYV4rxFKZZhDXiIT9hFNFX8yKt/pBCwjCKlWEz+59U43kWhiUZJ52faELCte62DNpuQ3 X-Received: by 2002:a05:6402:4492:b0:499:b4e4:8a83 with SMTP id er18-20020a056402449200b00499b4e48a83mr9930055edb.21.1674090886419; Wed, 18 Jan 2023 17:14:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674090886; cv=none; d=google.com; s=arc-20160816; b=mTesnmuw7jQRdFzsTVRX5noEWfoi6sdz5fiCqNtHwaTeChuEhXNNlRAlHqEG6Difbt Ogt6i3j8VeCBNk+EYp4ZNICpyUBZRuQ1vrfSeVWOZN9RXS139E1FjbJ2x1mf3OhN01yI eQc3vtklLD5lYzgfzJfe+cT1IiHgimBY0wjGG06nGWhwulpEAHXKE4BFyW8ywRUPjvSS 1qIrWa+wL9MN5ZRWv/4MtWjKGNdzFs7TiRgua+RRNYJoEhbQMEQI9QNv8klZmJaYbHkm D96XJBwOuZ1FqhytVLn3AulmnUCusB4+ZdK6uL2f5D8KY29A85GlDNbFmUZZ5ROgIl9Q P5UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:from:subject:cc:to :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=JU+eYoCUYw7OUrQ34xBj/dGRvIDzcpEGZXWLrE7d4zs=; b=s+xL9p4b6UXHtcH/ofupOXoTE4mogssB+eVfzVnv8x8+2A5Kd6PgwZRroc6FC1E6Kc E8fbaZMoU3Idx1+oWYIeBF2nRAb6WDIvsL6LM3TI1t4Sa66ri7j63M+fqII74vkMxvcM L4iZ+fVIE8VKCWe+dAqg1Gd9y9tQIqDduM27ZEzOEbPDvlfydBrk0g8nSMbs3IHK2s4m AaqfmQy8msZ/Z86NBGUUQoSau70WTpA+T6OsE8IKE0kX9zWf/U/bWhEZsCtuYVE2v55w fv0WMZZM6r9wNG2uZOiT+mNLDDBKwtmzDsD6vdGUtoCEZ7XBA50dekamh3DGnpZmf83H cECg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gz85+iNW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a056402524900b0046af9fdf3f5si45736720edd.282.2023.01.18.17.14.35; Wed, 18 Jan 2023 17:14:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gz85+iNW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjASA7Y (ORCPT + 44 others); Wed, 18 Jan 2023 19:59:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjASA7W (ORCPT ); Wed, 18 Jan 2023 19:59:22 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC961683D1; Wed, 18 Jan 2023 16:59:20 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id g205so313821pfb.6; Wed, 18 Jan 2023 16:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JU+eYoCUYw7OUrQ34xBj/dGRvIDzcpEGZXWLrE7d4zs=; b=gz85+iNW2Y3eSbshAzxzfhFFiBk15RBYYo/Ta22Cx4vNnkGWBnv61NxZF0xrGZP/fd LaA+Uf5VWLMzLkiJwEDaP+bh/zwItSGvisR/Thh89Far9EXZssVWqeAuRqKLyJDhEbsS 0hKFQw82MizFDTA6gDKiyiDOV8HssxWG11Fpukyy+wzf1SYfVnThV1z0P09wr6ipx1ay Npfy77cwwQ0eVt3CVdE5V+dLlYjXpFFF2wZE6VS6drERmj0Q0+PTz2kCBZww/gkVSAdQ Q+zi/+JSxaCsY/rnBk+T4KC9GpATG5f/5XlGEWFkk6KWqlwFAxPAWCAVAONGF2ADFCJc tRXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=JU+eYoCUYw7OUrQ34xBj/dGRvIDzcpEGZXWLrE7d4zs=; b=khGClFdjHYmHE3BDt/0hFUCsSNrrRDSOtn7eLVnwtahM317YSQl0pRYxWnL5hM23tt cUHJ6Y8LHjWDZ3yKnRAqadcy9Kfs+HO1Qer4a5Xdr9B81QsJlHQOAW3i2+A7zQrAkEy8 aotK8ebNeVVv3DbKRz+URlq5peOTjtEpLJo5WODg3rZTb+TfJHx0feKUkZPHnZTLhjj7 6oo2+9PYiggtcoEv55LCFtFRVHGUJIa1F5MnLFstaURdG4P4YsFFtjgCVoKPaMSen1bW SDkYn17S4kWHnYUWur4vtFbkicgwYmfUuTw0/qEw2RSsirz8es7VKhlB1NyT3DD3qf4E 4muQ== X-Gm-Message-State: AFqh2krk9vx2ehVvR0XlPLsUmYFGFATcMwMgBSHeUR27oemuwvha22bd 4xGy7ssd2w45WKrfAUfCwHE= X-Received: by 2002:a05:6a00:4207:b0:580:eeae:e4ba with SMTP id cd7-20020a056a00420700b00580eeaee4bamr10242724pfb.4.1674089960161; Wed, 18 Jan 2023 16:59:20 -0800 (PST) Received: from localhost (193-116-102-45.tpgi.com.au. [193.116.102.45]) by smtp.gmail.com with ESMTPSA id 134-20020a62148c000000b0056bc30e618dsm22728931pfu.38.2023.01.18.16.59.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 16:59:19 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 19 Jan 2023 10:59:12 +1000 Message-Id: To: "Andrew Donnellan" , , Cc: , , , , , , , , Subject: Re: [PATCH v3 02/24] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set From: "Nicholas Piggin" X-Mailer: aerc 0.13.0 References: <20230118061049.1006141-1-ajd@linux.ibm.com> <20230118061049.1006141-3-ajd@linux.ibm.com> In-Reply-To: <20230118061049.1006141-3-ajd@linux.ibm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed Jan 18, 2023 at 4:10 PM AEST, Andrew Donnellan wrote: > From: Russell Currey > > 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 > Signed-off-by: Andrew Donnellan > --- > 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/secva= r-ops.c > index 6a29777d6a2d..aa1b2adc2710 100644 > --- a/arch/powerpc/kernel/secvar-ops.c > +++ b/arch/powerpc/kernel/secvar-ops.c > @@ -8,10 +8,12 @@ > =20 > #include > #include > +#include > =20 > -const struct secvar_operations *secvar_ops __ro_after_init; > +const struct secvar_operations *secvar_ops __ro_after_init =3D NULL; > =20 > void set_secvar_ops(const struct secvar_operations *ops) > { > + WARN_ON_ONCE(secvar_ops); > secvar_ops =3D ops; You could make it return error here and two line patch in the caller to handle the error and then things wouldn't get corrupted. Thanks, Nick