From: Jon Mason <jdmason@kudzu.us>
To: "Jiang, Dave" <dave.jiang@intel.com>
Cc: "Allen.Hubbe@emc.com" <Allen.Hubbe@emc.com>,
"linux-ntb@googlegroups.com" <linux-ntb@googlegroups.com>
Subject: Re: [PATCH] NTB: Fix macro parameter conflict with field name
Date: Thu, 21 Jan 2016 19:53:44 -0500 [thread overview]
Message-ID: <20160122005343.GB18163@kudzu.us> (raw)
In-Reply-To: <1453417083.3824.28.camel@intel.com>
On Thu, Jan 21, 2016 at 10:58:07PM +0000, Jiang, Dave wrote:
> 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>
Included in the NTB git tree.
Thanks,
Jon
>
> > ---
> > �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
> >
prev parent reply other threads:[~2016-01-22 0:55 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
2016-01-22 0:53 ` Jon Mason [this message]
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=20160122005343.GB18163@kudzu.us \
--to=jdmason@kudzu.us \
--cc=Allen.Hubbe@emc.com \
--cc=dave.jiang@intel.com \
--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