Thread (4 messages) 4 messages, 2 authors, 2012-03-05

Re: [PATCH 1/1] Input: cyttsp - Fix check after pointer dereferencing

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-03-04 22:09:35

Hi Javier,

On Wed, Feb 15, 2012 at 11:42:52AM +0100, Javier Martinez Canillas wrote:
From: Javier Martinez Canillas <redacted>

In the cyttsp_probe() function the struct device *dev pointer was
dereferenced before checking if it was NULL.

Now dev is never NULL since both I2C and SPI bus drivers pass a pointer to a
member of an previously allocated structure. But others bus drivers can do
it differently so is better to sanity check instead of trust in the callers.
I already have a patch that simply removes the checks ofr dev and
bus_ops - cyttsp_probe is only called by bus-specific code and they are
not coming form platform data so there is no chance they will be NULL.
And anyone writing a new bus intefcae will get a nice oops first time
they try loading the module so they'll see the problem right away too.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help