mirror of
https://github.com/torvalds/linux.git
synced 2024-12-23 19:31:53 +00:00
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 <nbd@openwrt.org> Acked-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
c2a7dca0ce
commit
a5a7103fe1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user