diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2006-12-04 09:40:54 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-12-04 09:40:54 -0500 |
commit | ce26a8532fd062ccd3f3c589a4be269a2dc20f00 (patch) | |
tree | dba7b023453f6077bafb750cf7fd55c040723907 /include | |
parent | 09252e77ed13b1b412329825bad5797fbdd5a5c8 (diff) |
[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>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/cio.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h index cabd5bb74b5a..d92785030980 100644 --- a/include/asm-s390/cio.h +++ b/include/asm-s390/cio.h | |||
@@ -278,7 +278,10 @@ struct ccw_dev_id { | |||
278 | static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, | 278 | static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, |
279 | struct ccw_dev_id *dev_id2) | 279 | struct ccw_dev_id *dev_id2) |
280 | { | 280 | { |
281 | return !memcmp(dev_id1, dev_id2, sizeof(struct ccw_dev_id)); | 281 | if ((dev_id1->ssid == dev_id2->ssid) && |
282 | (dev_id1->devno == dev_id2->devno)) | ||
283 | return 1; | ||
284 | return 0; | ||
282 | } | 285 | } |
283 | 286 | ||
284 | extern int diag210(struct diag210 *addr); | 287 | extern int diag210(struct diag210 *addr); |