diff options
author | 2007-10-18 11:03:09 +0000 | |
---|---|---|
committer | 2007-10-18 11:03:09 +0000 | |
commit | 47be2d17922d27489adc18b75d2f8a30f9bb36db (patch) | |
tree | 790254222be673008e1dff8c033ee2a3c264fb65 | |
parent | Massive cleanup in the authentication code. the simple auth_key and the crypt (diff) | |
download | wireguard-openbsd-47be2d17922d27489adc18b75d2f8a30f9bb36db.tar.xz wireguard-openbsd-47be2d17922d27489adc18b75d2f8a30f9bb36db.zip |
Check to see if the SPD EEPROM size looks sane (ie < 32K)
when trying to decide if we have found an SPD EEPROM.
ok deraadt@
-rw-r--r-- | sys/dev/i2c/i2c_scan.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c index cea55cd62e1..59173813c22 100644 --- a/sys/dev/i2c/i2c_scan.c +++ b/sys/dev/i2c/i2c_scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2c_scan.c,v 1.104 2007/10/17 17:29:54 deraadt Exp $ */ +/* $OpenBSD: i2c_scan.c,v 1.105 2007/10/18 11:03:09 jsg Exp $ */ /* * Copyright (c) 2005 Theo de Raadt <deraadt@openbsd.org> @@ -904,7 +904,10 @@ iic_probe_eeprom(struct device *self, struct i2cbus_attach_args *iba, int reg, csum = 0; char *name = NULL; - /* only check SPD memory EEPROMs for now */ + /* SPD EEPROMs should only set lower nibble for size (ie <= 32K) */ + if ((iicprobe(0x01) & 0xf0) != 0) + return (name); + for (reg = 0; reg < 0x3f; reg++) csum += iicprobe(reg); |