Skip to content

Commit

Permalink
libata debugging: Warn when unable to find timing descriptor based on…
Browse files Browse the repository at this point in the history
… xfer_mode

ata_timing_find_mode could return NULL which is not checked by all
low-level ATA drivers using it and cause a NULL ptr deref. Warn at least
so that possible issues can get fixed easily.

Signed-off-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Borislav Petkov authored and Jeff Garzik committed Nov 16, 2012
1 parent c37472d commit cd705d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2942,6 +2942,10 @@ const struct ata_timing *ata_timing_find_mode(u8 xfer_mode)

if (xfer_mode == t->mode)
return t;

WARN_ONCE(true, "%s: unable to find timing for xfer_mode 0x%x\n",
__func__, xfer_mode);

return NULL;
}

Expand Down

0 comments on commit cd705d5

Please sign in to comment.