Skip to content

Commit

Permalink
[S390] cio: Make ccw_dev_id_is_equal() more robust.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cornelia Huck authored and Martin Schwidefsky committed Dec 4, 2006
1 parent 09252e7 commit ce26a85
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/asm-s390/cio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce26a85

Please sign in to comment.