Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1098155rwb; Tue, 27 Sep 2022 08:23:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hKRvDzqednBLaK2/ooD7y+LQsIj8lVYx4ZQiqALNFLMlNZjeQW/8jvbJ6S0lHW54brODh X-Received: by 2002:a63:6ac8:0:b0:43a:18ce:f681 with SMTP id f191-20020a636ac8000000b0043a18cef681mr24549289pgc.244.1664292187992; Tue, 27 Sep 2022 08:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664292187; cv=none; d=google.com; s=arc-20160816; b=zWkMWDPOGiSEkYt4Wcky8LsRQ6qjQQxY3C0PYBupyGlcwrUhecqol0zNr4eU6DTbZX 93j4p4SlnemQQIb1PiqYdCv6WqGAdIIdo2fyN+xZPx5B4aRHHTlMxyMoiCKG6bSyRwDt HjU37iXCwfTuOHDtQXbneHsrKN0+n3Siz3ZrD95GwwTYgkf2a9Pb9qXO0VbU1QhLZ/xg 3jx8i5kMFVk5oPprzqH7NdV3MXH5moW/OqkNdzizAUoisKvLVVmIN6scMXJOTJ5rWwTd K7Fl3W6odYfNnk5aUub9BQRFfEPDWdVwUTrSgbw2kZrERZK0Gz9aeNqZaw7ljcOBCgIY lS4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qaQ1tHKMb2kuBD7P0z2XGXuM+sCLUHs2ZGmbWRMnK0A=; b=q0K4W/cg1rZYYF8o51hbcF3cB1BVOzOXFjQpkJTtkBtur7okdHx1btQO9In8218X5f oCd4FpbEGDH0PMdZImmyKSRsm27qZL5Y9i3Yscf8q6OMmxeXhKVyhpulQEouitO4YM9B vL67dsfRjoYBNl0bATJ5UfLnMxiM0X/thd9z6NqFJXl9Mp6+Z9zpaGms4/kgoVSDZO9T lcjjPX25EbAFywfQFcMktlZ0adORD9qNMZp7xDdJeJm3fox97xiGUobJ972Frv2pLLlg 3mnwLAHRTTK6IOK/zlktFBJLBQNJjp9hMyq+mdREmcBkoqnmKHGTxWv53YBA6Ki3i85z p8pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vrGl2quL; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c198-20020a621ccf000000b0053f25053193si2271750pfc.77.2022.09.27.08.22.56; Tue, 27 Sep 2022 08:23:07 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=vrGl2quL; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbiI0O4c (ORCPT + 99 others); Tue, 27 Sep 2022 10:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbiI0O4F (ORCPT ); Tue, 27 Sep 2022 10:56:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 652C95AC6B; Tue, 27 Sep 2022 07:54:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69FFE61A05; Tue, 27 Sep 2022 14:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80B2DC433D7; Tue, 27 Sep 2022 14:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664290489; bh=U7CXbjuRUpWrnogBI5ZLChtegWrFmMKgB6ClDZvfrKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vrGl2quLpFfr5xI69aBEp+0I8RhtCzoq8bZTvmB1ti9L0FArjekTo6GTPIiQ56Z2k A52co9zvrDd7ESDe47O19aYLu7/eLrWzLQLOcInzKNvfSNZDh4Mn06EdS7InkSD2um QzDnbn2WsSDGnhywumia6NkAISIGaPxvokwMx1lM= Date: Tue, 27 Sep 2022 16:54:47 +0200 From: Greg Kroah-Hartman To: Miguel Ojeda Cc: Linus Torvalds , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Boqun Feng Subject: Re: [PATCH v10 03/27] kallsyms: add static relationship between `KSYM_NAME_LEN{,_BUFFER}` Message-ID: References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-4-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220927131518.30000-4-ojeda@kernel.org> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Tue, Sep 27, 2022 at 03:14:34PM +0200, Miguel Ojeda wrote: > This adds a static assert to ensure `KSYM_NAME_LEN_BUFFER` > gets updated when `KSYM_NAME_LEN` changes. > > The relationship used is one that keeps the new size (512+1) > close to the original buffer size (500). > > Co-developed-by: Boqun Feng > Signed-off-by: Boqun Feng > Signed-off-by: Miguel Ojeda > --- > scripts/kallsyms.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > index 25e2fe5fbcd4..411ff5058b51 100644 > --- a/scripts/kallsyms.c > +++ b/scripts/kallsyms.c > @@ -32,8 +32,18 @@ > > #define KSYM_NAME_LEN 128 > > -/* A substantially bigger size than the current maximum. */ > -#define KSYM_NAME_LEN_BUFFER 499 > +/* > + * A substantially bigger size than the current maximum. > + * > + * It cannot be defined as an expression because it gets stringified > + * for the fscanf() format string. Therefore, a _Static_assert() is > + * used instead to maintain the relationship with KSYM_NAME_LEN. > + */ > +#define KSYM_NAME_LEN_BUFFER 512 > +_Static_assert( > + KSYM_NAME_LEN_BUFFER == KSYM_NAME_LEN * 4, > + "Please keep KSYM_NAME_LEN_BUFFER in sync with KSYM_NAME_LEN" > +); Messy, but I can't think of any other way right now either :( Reviewed-by: Greg Kroah-Hartman