lkml.org 
[lkml]   [2006]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[S390] cio: Make ccw_dev_id_is_equal() more robust.
From: Cornelia Huck <cornelia.huck@de.ibm.com>

[S390] cio: Make ccw_dev_id_is_equal() more robust.

Using memcmp to compare ccw_dev_id implies that the whole structure (incl.
padding) has always been completely initialized to sane values. Comparing
the structures field by field doesn't make such assumptions.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

include/asm-s390/cio.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)

diff -urpN linux-2.6/include/asm-s390/cio.h linux-2.6-patched/include/asm-s390/cio.h
--- linux-2.6/include/asm-s390/cio.h 2006-12-04 14:50:48.000000000 +0100
+++ linux-2.6-patched/include/asm-s390/cio.h 2006-12-04 14:51:00.000000000 +0100
@@ -278,7 +278,10 @@ struct ccw_dev_id {
static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
struct ccw_dev_id *dev_id2)
{
- return !memcmp(dev_id1, dev_id2, sizeof(struct ccw_dev_id));
+ if ((dev_id1->ssid == dev_id2->ssid) &&
+ (dev_id1->devno == dev_id2->devno))
+ return 1;
+ return 0;
}

extern int diag210(struct diag210 *addr);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-12-04 16:05    [W:0.038 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site