On 01/08/2015 10:45 AM, Ilia Mirkin wrote:
On Wed, Jan 7, 2015 at 5:29 PM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
We have to check pointer before usage.
Reported-by: Andrey Karpov karpov@viva64.com Signed-off-by: Andy Shevchenko andy.shevchenko@gmail.com
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?
Thanks, Vince
if (!pstate) return -ENOMEM;
@@ -330,6 +329,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx)
pstate->pstate = perfE.pstate; pstate->fanspeed = perfE.fanspeed;
cstate = &pstate->base;
cstate->voltage = perfE.voltage; cstate->domain[nv_clk_src_core] = perfE.core; cstate->domain[nv_clk_src_shader] = perfE.shader;
-- 1.8.3.101.g727a46b
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------