netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ursula Braun <ursula.braun@de.ibm.com>
To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org
Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	"Andrew H. Richter" <richtera@us.ibm.com>,
	Ursula Braun <ursula.braun@de.ibm.com>
Subject: [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool
Date: Tue, 24 Mar 2009 14:27:51 +0100	[thread overview]
Message-ID: <20090324133049.899501000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20090324132742.300929000@linux.vnet.ibm.com

[-- Attachment #1: 628-claw-beam.diff --]
[-- Type: text/plain, Size: 3468 bytes --]

From: Andrew H. Richter <richtera@us.ibm.com>

This patch fixes two problems in the claw driver identified by
static code analysis:
o Change in case differentiation of received sense codes
o Use correct data length in claw hard_start_xmit routine

Signed-off-by: Andrew H. Richter <richtera@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---

 drivers/s390/net/claw.c |   44 ++++++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/claw.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/claw.c
+++ linux-2.6-uschi/drivers/s390/net/claw.c
@@ -1033,7 +1033,7 @@ static int
 pages_to_order_of_mag(int num_of_pages)
 {
 	int	order_of_mag=1;		/* assume 2 pages */
-	int	nump=2;
+	int	nump;
 
 	CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages);
 	if (num_of_pages == 1)   {return 0; }  /* magnitude of 0 = 1 page */
@@ -1187,37 +1187,31 @@ ccw_check_unit_check(struct chbk * p_ch,
 	dev_warn(dev, "The communication peer of %s disconnected\n",
 		ndev->name);
 
-        if (sense & 0x40) {
-                if (sense & 0x01) {
+	if (sense & 0x40) {
+		if (sense & 0x01) {
 			dev_warn(dev, "The remote channel adapter for"
 				" %s has been reset\n",
 				ndev->name);
-                }
-        }
-        else if (sense & 0x20) {
-                if (sense & 0x04) {
+		}
+	} else if (sense & 0x20) {
+		if (sense & 0x04) {
 			dev_warn(dev, "A data streaming timeout occurred"
 				" for %s\n",
 				ndev->name);
-                }
-                else  {
-			dev_warn(dev, "A data transfer parity error occurred"
-				" for %s\n",
-				ndev->name);
-                }
-        }
-        else if (sense & 0x10) {
-                if (sense & 0x20) {
+		} else if (sense & 0x10) {
 			dev_warn(dev, "The remote channel adapter for %s"
 				" is faulty\n",
 				ndev->name);
-                }
-                else {
-			dev_warn(dev, "A read data parity error occurred"
+		} else {
+			dev_warn(dev, "A data transfer parity error occurred"
 				" for %s\n",
 				ndev->name);
-                }
-        }
+		}
+	} else if (sense & 0x10) {
+		dev_warn(dev, "A read data parity error occurred"
+			" for %s\n",
+			ndev->name);
+	}
 
 }   /*    end of ccw_check_unit_check    */
 
@@ -1254,7 +1248,7 @@ find_link(struct net_device *dev, char *
 			break;
 	}
 
-        return 0;
+	return rc;
 }    /*    end of find_link    */
 
 /*-------------------------------------------------------------------*
@@ -1366,7 +1360,10 @@ claw_hw_tx(struct sk_buff *skb, struct n
                 privptr->p_write_free_chain=p_this_ccw->next;
                 p_this_ccw->next=NULL;
                 --privptr->write_free_count; /* -1 */
-                bytesInThisBuffer=len_of_data;
+		if (len_of_data >= privptr->p_env->write_size)
+			bytesInThisBuffer = privptr->p_env->write_size;
+		else
+			bytesInThisBuffer = len_of_data;
                 memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer);
                 len_of_data-=bytesInThisBuffer;
                 pDataAddress+=(unsigned long)bytesInThisBuffer;
@@ -2517,7 +2514,6 @@ unpack_read(struct net_device *dev )
 	p_dev = &privptr->channel[READ].cdev->dev;
 	p_env = privptr->p_env;
         p_this_ccw=privptr->p_read_active_first;
-        i=0;
 	while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) {
 		pack_off = 0;
 		p = 0;


  parent reply	other threads:[~2009-03-24 13:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 13:27 [patch 0/9] [RESEND] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
2009-03-24 13:27 ` [patch 1/9] [PATCH] Use kthread instead of kernel_thread Ursula Braun
2009-03-24 13:27 ` [patch 2/9] [PATCH] lcs: invalid return codes from hard_start_xmit Ursula Braun
2009-03-24 13:27 ` [patch 3/9] [PATCH] netiucv: invalid return code " Ursula Braun
2009-03-24 13:27 ` [patch 4/9] [PATCH] claw: invalid return codes " Ursula Braun
2009-03-24 13:27 ` [patch 5/9] [PATCH] ctcm: invalid return code " Ursula Braun
2009-03-24 13:27 ` [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data Ursula Braun
2009-03-24 13:27 ` [patch 7/9] [PATCH] ctcm: fix minor findings from code analysis tool Ursula Braun
2009-03-24 13:27 ` [patch 8/9] [PATCH] kmsg: convert claw printk messages to kmsg api Ursula Braun
2009-03-24 22:28   ` David Miller
2009-03-24 13:27 ` Ursula Braun [this message]
2009-03-24 22:29 ` [patch 0/9] [RESEND] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 David Miller
  -- strict thread matches above, loose matches on Subject: below --
2009-03-24 12:29 [patch 0/9] " Ursula Braun
2009-03-24 12:29 ` [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool Ursula Braun

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=20090324133049.899501000@linux.vnet.ibm.com \
    --to=ursula.braun@de.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richtera@us.ibm.com \
    --cc=schwidefsky@de.ibm.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).