Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2956824pxt; Mon, 9 Aug 2021 13:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx56PYzQ9iqHzgFy0TbDFIVDUJZAiVz3aJq4D+IaRlKgp0LGvwwIC7RuLXWI3Dtz1a4Oibh X-Received: by 2002:a6b:6319:: with SMTP id p25mr644238iog.100.1628539410456; Mon, 09 Aug 2021 13:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628539410; cv=none; d=google.com; s=arc-20160816; b=PwASlZUgjuYExLXpca3b7rA1B59UZIje0uEKdvvMI5/KrmPRIDxh7U3w8yhElQ+tzr jTMgM387AGNXUPPTYsA2s+4r9SCrQ6hGuzrVxHChnDgS7RWfmrcursuihgxRl6kIa90m w2cl7OOY3dI5opb5I78pwpFR+c6ATrp6v1e862QIuPJoAy6zXOJ/4k0wzJD5mASGIbbI GAp6fWThBJrPjhdXzM6nzUHp2v7y+d2FqLPL8cD0Dcy2FRSYcBj4m1rLFlQQ9jTNoPdM IBH4BdXXxfJNmyUJ2kyFBzUqK5Mn9DA76+dt+xicRVxmVzdOsD+0jzARWvaZyUVORIfE JI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:date:cc:to:from:subject:message-id; bh=6ituHsYkBuMm7Z8hxcsFY/YZ+11HICGJnuoCeV0PKU4=; b=XKf13+OotFxzdRQ7iH0cj93vyDwcsysyGpN/RrysXXW4Yme+n8mpaLaPzkRIAzZAI/ jtpLSidATdUzQTqTEM0z8bXGnj5ogLnJogypyBx2C03pJ/Sp4LRdXr/2JZjfwAqb/Mc+ uzbEnUq19+MFBJ4D0RPkgE+q+hV6sPW1fTU4QcvU+2T7JSnIng4tKqEfeuKQMu0LR6wi IVDjO0o7bjAwCWDVNBifWEYS3napvkxypMbMKqgHJNWgR+P6mJ1SAm4bBw+EgsJknFas Q2++RKAhnH/rcP4uooLAoZrvm3Oep9B3T6LBpnQ0YOra4fId15MlNuwMLq7bWpGMsxQE REXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si19373509jan.7.2021.08.09.13.03.16; Mon, 09 Aug 2021 13:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbhHIREZ (ORCPT + 99 others); Mon, 9 Aug 2021 13:04:25 -0400 Received: from smtprelay0153.hostedemail.com ([216.40.44.153]:49616 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229877AbhHIREY (ORCPT ); Mon, 9 Aug 2021 13:04:24 -0400 Received: from omf20.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id DC724180A68C0; Mon, 9 Aug 2021 17:04:02 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA id 11EC518A616; Mon, 9 Aug 2021 17:04:01 +0000 (UTC) Message-ID: <1f99c69f4e640accaf7459065e6625e73ec0f8d4.camel@perches.com> Subject: [PATCH] netlink: NL_SET_ERR_MSG - remove local static array From: Joe Perches To: netdev Cc: Johannes Berg , Jonathan Toppins , LKML Date: Mon, 09 Aug 2021 10:04:00 -0700 Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 11EC518A616 X-Spam-Status: No, score=-0.97 X-Stat-Signature: 1joi1f56hq7xsayp5qa835uknjh8widb X-Rspamd-Server: rspamout02 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX191vkcQB2Zva/2bFrMkOeuGf5dbTCrBcK4= X-HE-Tag: 1628528641-360961 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The want was to have some separate object section for netlink messages so all netlink messages could be specifically listed by some tool but the effect is duplicating static const char arrays in the object code. It seems unused presently so change the macro to avoid the local static declarations until such time as these actually are wanted and used. This reduces object size ~8KB in an x86-64 defconfig without modules. $ size vmlinux.o* text data bss dec hex filename 20110471 3460344 741760 24312575 172faff vmlinux.o.new 20119444 3460344 741760 24321548 1731e0c vmlinux.o.old Signed-off-by: Joe Perches --- include/linux/netlink.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 61b1c7fcc401e..4bb32ae134aa8 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -89,13 +89,12 @@ struct netlink_ext_ack { * to the lack of an output buffer.) */ #define NL_SET_ERR_MSG(extack, msg) do { \ - static const char __msg[] = msg; \ struct netlink_ext_ack *__extack = (extack); \ \ - do_trace_netlink_extack(__msg); \ + do_trace_netlink_extack(msg); \ \ if (__extack) \ - __extack->_msg = __msg; \ + __extack->_msg = msg; \ } while (0) #define NL_SET_ERR_MSG_MOD(extack, msg) \ @@ -111,13 +110,12 @@ struct netlink_ext_ack { #define NL_SET_BAD_ATTR(extack, attr) NL_SET_BAD_ATTR_POLICY(extack, attr, NULL) #define NL_SET_ERR_MSG_ATTR_POL(extack, attr, pol, msg) do { \ - static const char __msg[] = msg; \ struct netlink_ext_ack *__extack = (extack); \ \ - do_trace_netlink_extack(__msg); \ + do_trace_netlink_extack(msg); \ \ if (__extack) { \ - __extack->_msg = __msg; \ + __extack->_msg = msg; \ __extack->bad_attr = (attr); \ __extack->policy = (pol); \ } \