summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-06-27 16:28:07 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 18:03:06 -0700
commit23a83bfe6ab51c745d109d979c78a96fe3e93f5c (patch)
tree32f7e48ab0eb18966c709880747d8ed1c616e4a2 /drivers/pcmcia
parent1ad275e3e7d253d44f03868e85977c908e334fed (diff)
downloadop-kernel-dev-23a83bfe6ab51c745d109d979c78a96fe3e93f5c.zip
op-kernel-dev-23a83bfe6ab51c745d109d979c78a96fe3e93f5c.tar.gz
[PATCH] pcmcia: check for invalid crc32 hashes in id_tables
Check for invalid crc32 hashes in drivers' id_tables if CONFIG_PCMCIA_DEBUG is set. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/ds.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 5701b93..3ac7a44 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -260,6 +260,41 @@ void cs_error(client_handle_t handle, int func, int ret)
}
EXPORT_SYMBOL(cs_error);
+#ifdef CONFIG_PCMCIA_DEBUG
+
+
+static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
+{
+ struct pcmcia_device_id *did = p_drv->id_table;
+ unsigned int i;
+ u32 hash;
+
+ while (did && did->match_flags) {
+ for (i=0; i<4; i++) {
+ if (!did->prod_id[i])
+ continue;
+
+ hash = crc32(0, did->prod_id[i], strlen(did->prod_id[i]));
+ if (hash == did->prod_id_hash[i])
+ continue;
+
+ printk(KERN_DEBUG "pcmcia: %s: invalid hash for "
+ "product string \"%s\": is 0x%x, should "
+ "be 0x%x\n", p_drv->drv.name, did->prod_id[i],
+ did->prod_id_hash[i], hash);
+ }
+ did++;
+ }
+
+ return;
+}
+
+#else
+static inline void pcmcia_check_driver(struct pcmcia_driver *p_drv) {
+ return;
+}
+#endif
+
/*======================================================================*/
static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info);
@@ -296,6 +331,8 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
if (!driver)
return -EINVAL;
+ pcmcia_check_driver(driver);
+
/* initialize common fields */
driver->drv.bus = &pcmcia_bus_type;
driver->drv.owner = driver->owner;
OpenPOWER on IntegriCloud