Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
From: "Jiang, Dave" <dave.jiang@intel.com>
To: "Allen.Hubbe@emc.com" <Allen.Hubbe@emc.com>,
	"jdmason@kudzu.us" <jdmason@kudzu.us>,
	"linux-ntb@googlegroups.com" <linux-ntb@googlegroups.com>
Subject: Re: [PATCH] NTB: Fix macro parameter conflict with field name
Date: Thu, 21 Jan 2016 22:58:07 +0000	[thread overview]
Message-ID: <1453417083.3824.28.camel@intel.com> (raw)
In-Reply-To: <92f2c0f9f753ddb55242f01dd3d351191d2128c8.1453398752.git.Allen.Hubbe@emc.com>

On Thu, 2016-01-21 at 12:53 -0500, Allen Hubbe wrote:
> If the parameter given to the macro is replaced throughout the macro
> as
> it is evaluated.  The intent is that the macro parameter should
> replace
> the only the first parameter to container_of().  However, the way the
> macro was written, it would also inadvertantly replace a structure
> field
> name.  If a parameter of any other name is given to the macro, it
> will
> fail to compile, if the structure does not contain a field of the
> same
> name.  At worst, it will compile, and hide improper access of an
> unintended field in the structure.
> 
> Change the macro parameter name, so it does not conflict with the
> structure field name.
> 
> Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/ntb/hw/intel/ntb_hw_intel.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.h
> b/drivers/ntb/hw/intel/ntb_hw_intel.h
> index 2eb4addd10d0..43b3fe0d4aed 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_intel.h
> +++ b/drivers/ntb/hw/intel/ntb_hw_intel.h
> @@ -334,7 +334,8 @@ struct intel_ntb_dev {
>  #define ndev_pdev(ndev) ((ndev)->ntb.pdev)
>  #define ndev_name(ndev) pci_name(ndev_pdev(ndev))
>  #define ndev_dev(ndev) (&ndev_pdev(ndev)->dev)
> -#define ntb_ndev(ntb) container_of(ntb, struct intel_ntb_dev, ntb)
> -#define hb_ndev(work) container_of(work, struct intel_ntb_dev,
> hb_timer.work)
> +#define ntb_ndev(__ntb) container_of(__ntb, struct intel_ntb_dev,
> ntb)
> +#define hb_ndev(__work) container_of(__work, struct intel_ntb_dev, \
> +				     hb_timer.work)
>  
>  #endif
> -- 
> 2.7.0
> 

  reply	other threads:[~2016-01-21 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 17:53 [PATCH] NTB: Fix macro parameter conflict with field name Allen Hubbe
2016-01-21 22:58 ` Jiang, Dave [this message]
2016-01-22  0:53   ` Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453417083.3824.28.camel@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Allen.Hubbe@emc.com \
    --cc=jdmason@kudzu.us \
    --cc=linux-ntb@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox