Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570037
| From | Russell King - ARM Linux <linux@armlinux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence. |
| Date | 2017-01-30 20:10 +0100 |
| Message-ID | <t5puW-7L5-21@gated-at.bofh.it> (permalink) |
| References | <t5cem-804-13@gated-at.bofh.it> <t5cem-804-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jan 30, 2017 at 10:28:31AM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
Please explain how this can happen.
The driver is matched to the device via the driver model looking up
the compatible string in the match table:
.of_match_table = of_match_ptr(pxa_ssp_of_ids),
It then calls the probe function, which notices that there's a DT
node pointer, and the driver looks the device up in the very same
table.
If the driver model found a match and then the device driver didn't
for the very same device, something really bad went wrong.
So, if you want to add something:
if (WARN_ON(!id))
return -ENODEV;
should be about it, since it's something we expect to never encounter.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:00 +0100 Re: [PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence. Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-30 20:10 +0100
csiph-web