From: Cornelia Huck Date: Mon, 4 Dec 2006 14:40:54 +0000 (+0100) Subject: [S390] cio: Make ccw_dev_id_is_equal() more robust. X-Git-Tag: v2.6.20-rc1~34^2~40^2~15^2~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce26a8532fd062ccd3f3c589a4be269a2dc20f00;p=linux-2.6 [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 Signed-off-by: Martin Schwidefsky --- diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h index cabd5bb74b..d927850309 100644 --- a/include/asm-s390/cio.h +++ b/include/asm-s390/cio.h @@ -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);