Skip to content
Commit 9b6d90e2 authored by Zhou Qingyang's avatar Zhou Qingyang Committed by Damien Le Moal
Browse files

ata: pata_platform: Fix a NULL pointer dereference in __pata_platform_probe()

In __pata_platform_probe(), devm_kzalloc() is assigned to ap->ops and
there is a dereference of it right after that, which could introduce a
NULL pointer dereference bug.

Fix this by adding a NULL check of ap->ops.

This bug was found by a static analyzer.

Builds with 'make allyesconfig' show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: f3d5e4f1

 ("ata: pata_of_platform: Allow to use 16-bit wide data transfer")
Signed-off-by: default avatarZhou Qingyang <zhou1615@umn.edu>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
parent 0280e3c5
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment