netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] s390 network driver patches
@ 2016-10-12 10:38 Ursula Braun
  2016-10-12 10:38 ` [PATCH net 1/3] s390/netiucv: get rid of one memcpy in netiucv_printuser Ursula Braun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ursula Braun @ 2016-10-12 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun

Hi Dave,

here are 3 small patches for the s390 network drivers netiucv and lcs.
They are built for the net-tree.

Thanks, Ursula

Ursula Braun (2):
  s390/netiucv: get rid of one memcpy in netiucv_printuser
  s390/netiucv: improve checking of sysfs attribute buffer

Colin Ian King (1):
  s390/lcs: remove trailing space at end of dev_err message

 drivers/s390/net/lcs.c     |  2 +-
 drivers/s390/net/netiucv.c | 17 ++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

-- 
2.8.4

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

* [PATCH net 1/3] s390/netiucv: get rid of one memcpy in netiucv_printuser
  2016-10-12 10:38 [PATCH net 0/3] s390 network driver patches Ursula Braun
@ 2016-10-12 10:38 ` Ursula Braun
  2016-10-12 10:38 ` [PATCH net 2/3] s390/netiucv: improve checking of sysfs attribute buffer Ursula Braun
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ursula Braun @ 2016-10-12 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun

Save a memcpy in netiucv_printuser().

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reported-by: David Binderman <dcb314@hotmail.com>
---
 drivers/s390/net/netiucv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index b0e8ffd..88b6e9c 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -302,8 +302,7 @@ static char *netiucv_printuser(struct iucv_connection *conn)
 	if (memcmp(conn->userdata, iucvMagic_ebcdic, 16)) {
 		tmp_uid[8] = '\0';
 		tmp_udat[16] = '\0';
-		memcpy(tmp_uid, conn->userid, 8);
-		memcpy(tmp_uid, netiucv_printname(tmp_uid, 8), 8);
+		memcpy(tmp_uid, netiucv_printname(conn->userid, 8), 8);
 		memcpy(tmp_udat, conn->userdata, 16);
 		EBCASC(tmp_udat, 16);
 		memcpy(tmp_udat, netiucv_printname(tmp_udat, 16), 16);
-- 
2.8.4

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

* [PATCH net 2/3] s390/netiucv: improve checking of sysfs attribute buffer
  2016-10-12 10:38 [PATCH net 0/3] s390 network driver patches Ursula Braun
  2016-10-12 10:38 ` [PATCH net 1/3] s390/netiucv: get rid of one memcpy in netiucv_printuser Ursula Braun
@ 2016-10-12 10:38 ` Ursula Braun
  2016-10-12 10:38 ` [PATCH net 3/3] s390/lcs: remove trailing space at end of dev_err message Ursula Braun
  2016-10-13 15:00 ` [PATCH net 0/3] s390 network driver patches David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ursula Braun @ 2016-10-12 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun

High values are always wrong for netiucv's sysfs attribute "buffer".
But the current code does not detect values between 2**31 and 2**32
as invalid. Choosing type "unsigned int" for variable "bs1" and making
use of "kstrtouint()" improves the syntax checking for "buffer".

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/s390/net/netiucv.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 88b6e9c..2f0f391 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1563,21 +1563,21 @@ static ssize_t buffer_write (struct device *dev, struct device_attribute *attr,
 {
 	struct netiucv_priv *priv = dev_get_drvdata(dev);
 	struct net_device *ndev = priv->conn->netdev;
-	char         *e;
-	int          bs1;
+	unsigned int bs1;
+	int rc;
 
 	IUCV_DBF_TEXT(trace, 3, __func__);
 	if (count >= 39)
 		return -EINVAL;
 
-	bs1 = simple_strtoul(buf, &e, 0);
+	rc = kstrtouint(buf, 0, &bs1);
 
-	if (e && (!isspace(*e))) {
-		IUCV_DBF_TEXT_(setup, 2, "buffer_write: invalid char %02x\n",
-			*e);
+	if (rc == -EINVAL) {
+		IUCV_DBF_TEXT_(setup, 2, "buffer_write: invalid char %s\n",
+			buf);
 		return -EINVAL;
 	}
-	if (bs1 > NETIUCV_BUFSIZE_MAX) {
+	if ((rc == -ERANGE) || (bs1 > NETIUCV_BUFSIZE_MAX)) {
 		IUCV_DBF_TEXT_(setup, 2,
 			"buffer_write: buffer size %d too large\n",
 			bs1);
-- 
2.8.4

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

* [PATCH net 3/3] s390/lcs: remove trailing space at end of dev_err message
  2016-10-12 10:38 [PATCH net 0/3] s390 network driver patches Ursula Braun
  2016-10-12 10:38 ` [PATCH net 1/3] s390/netiucv: get rid of one memcpy in netiucv_printuser Ursula Braun
  2016-10-12 10:38 ` [PATCH net 2/3] s390/netiucv: improve checking of sysfs attribute buffer Ursula Braun
@ 2016-10-12 10:38 ` Ursula Braun
  2016-10-13 15:00 ` [PATCH net 0/3] s390 network driver patches David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ursula Braun @ 2016-10-12 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun

From: Colin Ian King <colin.king@canonical.com> 

There is a trailing white space at the end of a dev_err
message that does nothing useful - remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 drivers/s390/net/lcs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 251db0a..211b31d 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -1888,7 +1888,7 @@ lcs_stop_device(struct net_device *dev)
 	rc = lcs_stopcard(card);
 	if (rc)
 		dev_err(&card->dev->dev,
-			" Shutting down the LCS device failed\n ");
+			" Shutting down the LCS device failed\n");
 	return rc;
 }
 
-- 
2.8.4

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

* Re: [PATCH net 0/3] s390 network driver patches
  2016-10-12 10:38 [PATCH net 0/3] s390 network driver patches Ursula Braun
                   ` (2 preceding siblings ...)
  2016-10-12 10:38 ` [PATCH net 3/3] s390/lcs: remove trailing space at end of dev_err message Ursula Braun
@ 2016-10-13 15:00 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-10-13 15:00 UTC (permalink / raw)
  To: ubraun; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens

From: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date: Wed, 12 Oct 2016 12:38:48 +0200

> here are 3 small patches for the s390 network drivers netiucv and lcs.
> They are built for the net-tree.

Series applied, thanks.

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

end of thread, other threads:[~2016-10-13 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 10:38 [PATCH net 0/3] s390 network driver patches Ursula Braun
2016-10-12 10:38 ` [PATCH net 1/3] s390/netiucv: get rid of one memcpy in netiucv_printuser Ursula Braun
2016-10-12 10:38 ` [PATCH net 2/3] s390/netiucv: improve checking of sysfs attribute buffer Ursula Braun
2016-10-12 10:38 ` [PATCH net 3/3] s390/lcs: remove trailing space at end of dev_err message Ursula Braun
2016-10-13 15:00 ` [PATCH net 0/3] s390 network driver patches 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).