netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15
@ 2016-11-15 22:10 Tom Lendacky
  2016-11-15 22:11 ` [PATCH net-next 1/2] amd-xgbe: Fix possible uninitialized variable Tom Lendacky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Lendacky @ 2016-11-15 22:10 UTC (permalink / raw)
  To: netdev; +Cc: colin.king, David Miller, dan.carpenter

This patch series addresses some minor issues found in the recently
accepted patch series for the AMD XGBE driver.

The following fixes are included in this driver update series:

- Fix a possibly uninitialized variable in the debugfs support
- Fix the GPIO pin number constraint check

This patch series is based on net-next.

---

Tom Lendacky (2):
      amd-xgbe: Fix possible uninitialized variable
      amd-xgbe: Fix maximum GPIO value check


 drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c |    2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-dev.c     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
Tom Lendacky

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] amd-xgbe: Fix possible uninitialized variable
  2016-11-15 22:10 [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 Tom Lendacky
@ 2016-11-15 22:11 ` Tom Lendacky
  2016-11-15 22:11 ` [PATCH net-next 2/2] amd-xgbe: Fix maximum GPIO value check Tom Lendacky
  2016-11-16 18:58 ` [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2016-11-15 22:11 UTC (permalink / raw)
  To: netdev; +Cc: colin.king, David Miller, dan.carpenter

The debugfs support in the driver uses a common routine to write the
debugfs values. In this routine, if the input file position is non-zero
then the write routine will not return an error and an output parameter
will not have been set. Because an error isn't returned an uninitialized
value will be written into a register.

Fix the common write routine to return an error if the input file position
is non-zero, which will propagate back to the caller.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
index 0c0140d..7546b66 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
@@ -153,7 +153,7 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
 	int ret;
 
 	if (*ppos != 0)
-		return 0;
+		return -EINVAL;
 
 	if (count >= sizeof(workarea))
 		return -ENOSPC;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] amd-xgbe: Fix maximum GPIO value check
  2016-11-15 22:10 [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 Tom Lendacky
  2016-11-15 22:11 ` [PATCH net-next 1/2] amd-xgbe: Fix possible uninitialized variable Tom Lendacky
@ 2016-11-15 22:11 ` Tom Lendacky
  2016-11-16 18:58 ` [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2016-11-15 22:11 UTC (permalink / raw)
  To: netdev; +Cc: colin.king, David Miller, dan.carpenter

The GPIO support in the hardware allows for up to 16 GPIO pins, enumerated
from 0 to 15.  The driver uses the wrong value (16) to validate the GPIO
pin range in the routines to set and clear the GPIO output pins.  Update
the code to use the correct value (15).

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 30056e2..aaf0350 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1099,7 +1099,7 @@ static int xgbe_clr_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
 {
 	unsigned int reg;
 
-	if (gpio > 16)
+	if (gpio > 15)
 		return -EINVAL;
 
 	reg = XGMAC_IOREAD(pdata, MAC_GPIOSR);
@@ -1114,7 +1114,7 @@ static int xgbe_set_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
 {
 	unsigned int reg;
 
-	if (gpio > 16)
+	if (gpio > 15)
 		return -EINVAL;
 
 	reg = XGMAC_IOREAD(pdata, MAC_GPIOSR);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15
  2016-11-15 22:10 [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 Tom Lendacky
  2016-11-15 22:11 ` [PATCH net-next 1/2] amd-xgbe: Fix possible uninitialized variable Tom Lendacky
  2016-11-15 22:11 ` [PATCH net-next 2/2] amd-xgbe: Fix maximum GPIO value check Tom Lendacky
@ 2016-11-16 18:58 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-11-16 18:58 UTC (permalink / raw)
  To: thomas.lendacky; +Cc: netdev, colin.king, dan.carpenter

From: Tom Lendacky <thomas.lendacky@amd.com>
Date: Tue, 15 Nov 2016 16:10:55 -0600

> This patch series addresses some minor issues found in the recently
> accepted patch series for the AMD XGBE driver.
> 
> The following fixes are included in this driver update series:
> 
> - Fix a possibly uninitialized variable in the debugfs support
> - Fix the GPIO pin number constraint check
> 
> This patch series is based on net-next.

Series applied, thanks Tom.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-16 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-15 22:10 [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 Tom Lendacky
2016-11-15 22:11 ` [PATCH net-next 1/2] amd-xgbe: Fix possible uninitialized variable Tom Lendacky
2016-11-15 22:11 ` [PATCH net-next 2/2] amd-xgbe: Fix maximum GPIO value check Tom Lendacky
2016-11-16 18:58 ` [PATCH net-next 0/2] amd-xgbe: AMD XGBE driver updates 2016-11-15 David Miller

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).