From patchwork Tue Apr 15 01:56:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daeseok Youn X-Patchwork-Id: 3993531 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB3B79F336 for ; Tue, 15 Apr 2014 14:56:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E5F82021A for ; Tue, 15 Apr 2014 14:56:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5156A2022A for ; Tue, 15 Apr 2014 14:56:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6661F6E261; Tue, 15 Apr 2014 07:56:37 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by gabe.freedesktop.org (Postfix) with ESMTP id A099B6E155 for ; Mon, 14 Apr 2014 18:56:54 -0700 (PDT) Received: by mail-pb0-f54.google.com with SMTP id ma3so8916539pbc.27 for ; Mon, 14 Apr 2014 18:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=YXUxr7g2gY83+It8QRwAq79VlOziwiRm8bgY1oIcZUU=; b=aMJzBjEzaFaoQ/zuMNGjw7+HhMXiNd+zjTPsD7PiqfUIVnO1JoAGEmd2+IjQq8veko 3CSyqehE5GdrQZpgkYPAD9EJoqOV5YcQtfILLLBhs9HoVWjaJPJTRQIS76dW4v73GGpK KAVsp34iOufK6EzKDqAPiDe3MCmCNP3/WRKKqknhDHh1se87HTF7jT/Y6GGxAN6ig6PM W4ZMjCAn6eUHUALaDjl944XRZ2ObK3C3JM/WUxeTSU9tgfC8bW2QpVvFLCCSi0ZdrF6x /JbDN9U1LAbZjhx4J2ZvoC7uoDTxdnpiRD2TNMYezbrNM0OZFIcoqDCj9Mk5eE7Mh/4E 1h8g== X-Received: by 10.69.20.107 with SMTP id hb11mr41044278pbd.99.1397527014444; Mon, 14 Apr 2014 18:56:54 -0700 (PDT) Received: from daeseok-laptop.cloud.net ([121.50.21.19]) by mx.google.com with ESMTPSA id rk15sm87770606pab.37.2014.04.14.18.56.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 18:56:53 -0700 (PDT) From: Daeseok Youn To: airlied@linux.ie Subject: [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference Date: Tue, 15 Apr 2014 10:56:49 +0900 Message-ID: <3009531.aHrQhHYAOc@daeseok-laptop.cloud.net> User-Agent: KMail/4.8.5 (Linux/3.2.0-58-generic; KDE/4.8.5; x86_64; ; ) MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 15 Apr 2014 07:56:36 -0700 Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It need to be checking NULL before dereferencing. Signed-off-by: Daeseok Youn --- drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c index dd62bae..a586d030 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c @@ -290,9 +290,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx) return 0; pstate = kzalloc(sizeof(*pstate), GFP_KERNEL); - cstate = &pstate->base; if (!pstate) return -ENOMEM; + cstate = &pstate->base; INIT_LIST_HEAD(&pstate->list);