Re: [PATCH v1] drm/nouveau/clk: avoid potential null-dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 7, 2015 at 11:32 PM, Vince Hsu <vinceh@xxxxxxxxxx> wrote:
>
> On 01/08/2015 10:45 AM, Ilia Mirkin wrote:
>>
>> On Wed, Jan 7, 2015 at 5:29 PM, Andy Shevchenko
>> <andy.shevchenko@xxxxxxxxx> wrote:
>>>
>>> We have to check pointer before usage.
>>>
>>> Reported-by: Andrey Karpov <karpov@xxxxxxxxxx>
>>> Signed-off-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
>>> ---
>>>   drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>>> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>>> index e51b72d..2e84436 100644
>>> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>>> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>>> @@ -322,7 +322,6 @@ nouveau_pstate_new(struct nouveau_clock *clk, int
>>> idx)
>>>                  return 0;
>>>
>>>          pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
>>> -       cstate = &pstate->base;
>>
>> What's wrong with this line? If pstate == NULL, &pstate->base == NULL
>> as well and we return.
>
> If pstate == NULL (kzalloc returned NULL), pstate->base triggers a null
> pointer
> deference error?

Where do you see "pstate->base"? I only see "&pstate->base" which
merely computes an offset into a structure... No reason to dereference
pstate.

  -ilia
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux