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 F0BC3C74A5B for ; Thu, 23 Mar 2023 20:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbjCWUe1 (ORCPT ); Thu, 23 Mar 2023 16:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjCWUe0 (ORCPT ); Thu, 23 Mar 2023 16:34:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE798FF0E for ; Thu, 23 Mar 2023 13:34:25 -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 1D338628A0 for ; Thu, 23 Mar 2023 20:34:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85C9DC433EF; Thu, 23 Mar 2023 20:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679603664; bh=LV+wPG6mP4ZGZkf70LwDcE+PYbxFku3PzFdtmsHbi4o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EQTXQigv7VN9ZWyM58fTMwQogL7bs/pPDr2SB+HTTv3Mr6J01ui1S9CLUC9SSwFXZ f4JVplJIg78G0wAxX4EiljH/UM7TMoUDA2/7qLvDOeYbVad6rUyMh08JARVkgjuVe7 nKwb+q37NIPZaG0kIEvk008gEOavYExBbmhgRlRjA1VYsC6CTFW86XyGVEmmQpNdz4 xgR842TdDn5x83w8BsZC7L5LNq39FRuWGslPXKAlU/u2HnFcxTDCDc2hLrJfnHQ0u4 IKppPJLv1gjIbGBUfwNqfrg05FtzlKrI7T0QuRkp496Cf3SpUE6/vywb45Fc83hX25 YERJP37A1qgyg== Date: Thu, 23 Mar 2023 13:34:22 -0700 From: Jakub Kicinski To: Shay Agroskin Cc: Paolo Abeni , David Miller , , "Woodhouse, David" , "Machulsky, Zorik" , "Matushevsky, Alexander" , Saeed Bshara , "Wilson, Matt" , "Liguori, Anthony" , "Bshara, Nafea" , "Belgazal, Netanel" , "Saidi, Ali" , "Herrenschmidt, Benjamin" , "Kiyanovski, Arthur" , "Dagan, Noam" , "Arinzon, David" , "Itzko, Shahar" , "Abboud, Osama" , Eric Dumazet , Vladimir Oltean , Andrew Lunn , Guangbin Huang , Jie Wang , Johannes Berg , Edward Cree , "Florian Westphal" Subject: Re: [PATCH v6 net-next 1/7] netlink: Add a macro to set policy message with format string Message-ID: <20230323133422.110d6cab@kernel.org> In-Reply-To: References: <20230320132523.3203254-1-shayagr@amazon.com> <20230320132523.3203254-2-shayagr@amazon.com> <20230322114041.71df75d1@kernel.org> <20230323095454.048d7130@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 23 Mar 2023 21:44:52 +0200 Shay Agroskin wrote: > > That's why we have the local variable called __extack, that we > > *can* > > use multiple times, because it's a separate variable, (extack) > > is > > evaluated only once, to initialize it... > > > > We don't need to copy the string formatting, unless I'm missing > > something. Paolo was just asking for: > > There is an issue with shadowing __extack by NL_SET_ERR_MSG_FMT > causing the changes to __extack not to be propagated back to the > caller. > I'm not that big of an expert in C but changing __extack -> > _extack fixes the shadowing issue. > > Might not be the most robust solution, though it might suffice for > this use case. TBH the hierarchy should be the other way around, NL_SET_ERR_MSG_FMT() should be converted to be: #define NL_SET_ERR_MSG_FMT(extack, attr, msg, args...) \ NL_SET_ERR_MSG_ATTR_POL_FMT(extack, NULL, NULL, msg, ##args) and that'd fix the shadowing, right?