From: Dan Carpenter <dan.carpenter@oracle.com>
To: Roopa Prabhu <roprabhu@cisco.com>
Cc: Christian Benvenuti <benve@cisco.com>,
Neel Patel <neepatel@cisco.com>,
Nishank Trivedi <nistrive@cisco.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] enic: fix an endian bug in enic_probe()
Date: Thu, 01 Mar 2012 07:19:54 +0000 [thread overview]
Message-ID: <20120301071954.GA7152@elgon.mountain> (raw)
"num_vfs" is a u32 but we only use the high 16 bits and the low 16bits
are left as zero. That isn't a problem for little endian systems but it
will break on big endian ones.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index 99998c6..cf1fb4b 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -94,7 +94,7 @@ struct enic {
u32 rx_coalesce_usecs;
u32 tx_coalesce_usecs;
#ifdef CONFIG_PCI_IOV
- u32 num_vfs;
+ u16 num_vfs;
#endif
struct enic_port_profile *pp;
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index e27ec1d..9080ed6 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -2390,7 +2390,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
if (pos) {
pci_read_config_word(pdev, pos + PCI_SRIOV_TOTAL_VF,
- (u16 *)&enic->num_vfs);
+ &enic->num_vfs);
if (enic->num_vfs) {
err = pci_enable_sriov(pdev, enic->num_vfs);
if (err) {
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Roopa Prabhu <roprabhu@cisco.com>
Cc: Christian Benvenuti <benve@cisco.com>,
Neel Patel <neepatel@cisco.com>,
Nishank Trivedi <nistrive@cisco.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] enic: fix an endian bug in enic_probe()
Date: Thu, 1 Mar 2012 10:19:54 +0300 [thread overview]
Message-ID: <20120301071954.GA7152@elgon.mountain> (raw)
"num_vfs" is a u32 but we only use the high 16 bits and the low 16bits
are left as zero. That isn't a problem for little endian systems but it
will break on big endian ones.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index 99998c6..cf1fb4b 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -94,7 +94,7 @@ struct enic {
u32 rx_coalesce_usecs;
u32 tx_coalesce_usecs;
#ifdef CONFIG_PCI_IOV
- u32 num_vfs;
+ u16 num_vfs;
#endif
struct enic_port_profile *pp;
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index e27ec1d..9080ed6 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -2390,7 +2390,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
if (pos) {
pci_read_config_word(pdev, pos + PCI_SRIOV_TOTAL_VF,
- (u16 *)&enic->num_vfs);
+ &enic->num_vfs);
if (enic->num_vfs) {
err = pci_enable_sriov(pdev, enic->num_vfs);
if (err) {
next reply other threads:[~2012-03-01 7:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 7:19 Dan Carpenter [this message]
2012-03-01 7:19 ` [patch] enic: fix an endian bug in enic_probe() Dan Carpenter
2012-03-01 22:24 ` David Miller
2012-03-01 22:24 ` David Miller
2012-03-02 1:23 ` Christian Benvenuti (benve)
2012-03-02 1:23 ` Christian Benvenuti (benve)
2012-03-02 6:06 ` Dan Carpenter
2012-03-02 6:06 ` Dan Carpenter
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=20120301071954.GA7152@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=benve@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=neepatel@cisco.com \
--cc=netdev@vger.kernel.org \
--cc=nistrive@cisco.com \
--cc=roprabhu@cisco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.