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 10E92C433EF for ; Wed, 27 Apr 2022 09:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234870AbiD0JJg (ORCPT ); Wed, 27 Apr 2022 05:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232898AbiD0JJA (ORCPT ); Wed, 27 Apr 2022 05:09:00 -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 B66976D397 for ; Wed, 27 Apr 2022 02:05:46 -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 A79E461C11 for ; Wed, 27 Apr 2022 09:04:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A93EC385AE; Wed, 27 Apr 2022 09:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651050288; bh=T3TeOxjkIya0gidMNU4IwIgPgO6yLgii9YhkKzTmk7I=; h=From:To:Cc:Subject:Date:From; b=lN8MtJNGyB09gzH+12y2anSran25Oy/FXKk8BEtAmQjPJhOd8ddWDwBkgzv5kAp7c 6qhwJbaE4wfpqMRN6RBNyjGQ0KvUOOf9jv+LYLRxE26dtgl0p/l57cmm00guNtfxeF PRL3lJlKwn7IevU0p4uWDbFH6DLw7Yntzdb2XK0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Miroslav Benes , Emil Velikov , Jessica Yu , Quentin Perret , Masahiro Yamada , Matthias Maennich Subject: [PATCH v2] export: fix string handling of namespace in EXPORT_SYMBOL_NS Date: Wed, 27 Apr 2022 11:04:42 +0200 Message-Id: <20220427090442.2105905-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2049; i=gregkh@linuxfoundation.org; h=from:subject; bh=T3TeOxjkIya0gidMNU4IwIgPgO6yLgii9YhkKzTmk7I=; b=owGbwMvMwCRo6H6F97bub03G02pJDEmZ7FpOy0ROpWXI/OIW3PN3hgBHOrPgHT7TBMvTdgZS90v7 Vvp1xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwESYbzPMFeg1at5+Kqn3yPRpt1kURH 8rWTKUMMzhTIn7Vc73eMmi1Zs1Dz+UZ11Y3O4NAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit c3a6cf19e695 ("export: avoid code duplication in include/linux/export.h") broke the ability for a defined string to be used as a namespace value. Fix this up by using stringify to properly encode the namespace name. Fixes: c3a6cf19e695 ("export: avoid code duplication in include/linux/export.h") Cc: Miroslav Benes Cc: Emil Velikov Cc: Jessica Yu Cc: Quentin Perret Cc: Masahiro Yamada Cc: Matthias Maennich Signed-off-by: Greg Kroah-Hartman --- v2: use stringify() instead of 2 step redirection as pointed out by Masahiro include/linux/export.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/export.h b/include/linux/export.h index 27d848712b90..5910ccb66ca2 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -2,6 +2,8 @@ #ifndef _LINUX_EXPORT_H #define _LINUX_EXPORT_H +#include + /* * Export symbols from the kernel to modules. Forked from module.h * to reduce the amount of pointless cruft we feed to gcc when only @@ -154,7 +156,6 @@ struct kernel_symbol { #endif /* CONFIG_MODULES */ #ifdef DEFAULT_SYMBOL_NAMESPACE -#include #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, __stringify(DEFAULT_SYMBOL_NAMESPACE)) #else #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "") @@ -162,8 +163,8 @@ struct kernel_symbol { #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "") #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl") -#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns) -#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns) +#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", __stringify(ns)) +#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", __stringify(ns)) #endif /* !__ASSEMBLY__ */ -- 2.36.0