From: Felix Fietkau Date: Sun, 27 Feb 2011 21:19:22 +0000 (+0100) Subject: p54: fix a NULL pointer dereference bug X-Git-Tag: firefly_0821_release~7613^2~967^2~16^2~578^2~93 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a5a7103fe18eb4312bd89c9f136fb850af58faf4;p=firefly-linux-kernel-4.4.55.git p54: fix a NULL pointer dereference bug If the RSSI calibration table was not found or not parsed properly, priv->rssi_db will be NULL, p54_rssi_find needs to be able to deal with that. Signed-off-by: Felix Fietkau Acked-by: Christian Lamparter Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index f54e15fcd623..13d750da9301 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c @@ -524,10 +524,13 @@ err_data: struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *priv, const u16 freq) { - struct p54_rssi_db_entry *entry = (void *)(priv->rssi_db->data + - priv->rssi_db->offset); + struct p54_rssi_db_entry *entry; int i, found = -1; + if (!priv->rssi_db) + return &p54_rssi_default; + + entry = (void *)(priv->rssi_db->data + priv->rssi_db->offset); for (i = 0; i < priv->rssi_db->entries; i++) { if (!same_band(freq, entry[i].freq)) continue;