From: Joe Perches <joe@perches.com>
To: Scott Goldman <scottjg@vmware.com>
Cc: Shreyas Bhatewara <sbhatewara@vmware.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"pv-drivers@vmware.com" <pv-drivers@vmware.com>
Subject: RE: [Pv-drivers] [PATCH net-next] vmxnet3: set netdev parant device before calling netdev_info
Date: Wed, 20 Jul 2011 20:49:01 -0700 [thread overview]
Message-ID: <1311220141.1663.24.camel@Joe-Laptop> (raw)
In-Reply-To: <03E840D17E263A48A5766AD576E0423A03C5836359@exch-mbx-111.vmware.com>
On Wed, 2011-07-20 at 20:06 -0700, Scott Goldman wrote:
> > Parent device for netdev should be set before netdev_info() can be called
> > otherwise there is a NULL pointer dereference and probe() fails.
I believe this is not true.
I don't see any NULL pointer dereference here.
functions and macros reordered top to bottom.
define_netdev_printk_level(netdev_info, KERN_INFO);
#define define_netdev_printk_level(func, level) \
int func(const struct net_device *dev, const char *fmt, ...) \
{ \
int r; \
struct va_format vaf; \
va_list args; \
\
va_start(args, fmt); \
\
vaf.fmt = fmt; \
vaf.va = &args; \
\
r = __netdev_printk(level, dev, &vaf); \
va_end(args); \
\
return r; \
} \
EXPORT_SYMBOL(func);
static int __netdev_printk(const char *level, const struct net_device *dev,
struct va_format *vaf)
{
int r;
if (dev && dev->dev.parent)
r = dev_printk(level, dev->dev.parent, "%s: %pV",
netdev_name(dev), vaf);
else if (dev)
r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
else
r = printk("%s(NULL net_device): %pV", level, vaf);
return r;
}
static inline const char *netdev_name(const struct net_device *dev)
{
if (dev->reg_state != NETREG_REGISTERED)
return "(unregistered net_device)";
return dev->name;
}
next prev parent reply other threads:[~2011-07-21 3:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 2:01 [PATCH net-next] vmxnet3: set netdev parant device before calling netdev_info Shreyas Bhatewara
2011-07-21 3:06 ` [Pv-drivers] " Scott Goldman
2011-07-21 3:49 ` Joe Perches [this message]
2011-07-21 4:05 ` Shreyas Bhatewara
2011-07-22 4:34 ` David Miller
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=1311220141.1663.24.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=netdev@vger.kernel.org \
--cc=pv-drivers@vmware.com \
--cc=sbhatewara@vmware.com \
--cc=scottjg@vmware.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;
as well as URLs for NNTP newsgroup(s).