lkml.org 
[lkml]   [2017]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ASoC: Intel: Skylake: fix dereference before NULL check on ebus
From
Date
On 19/04/17 14:32, Dan Carpenter wrote:
> On Wed, Apr 19, 2017 at 01:16:13PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> ebus is being NULL checked however it is being dereferenced
>> earlier on the assignment bus = ebus_to_hbus(ebus). Fix this
>> by moving the assignment to after the NULL check on ebus to
>> avoid a NULL pointer dereference error.
>>
>
> ebus_to_hbus() doesn't dereference "ebus" it just uses it for pointer
> math.
>
> #define ebus_to_hbus(ebus) (&(ebus)->bus)
>
> If you pass a NULL to there, it returns an offset starting from NULL but
> it doesn't Oops.

Doh, brown paper bag moment for me.

>
> regards,
> dan carpenter
>
>

\
 
 \ /
  Last update: 2017-04-19 15:35    [W:0.042 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site