From patchwork Wed Aug 3 19:51:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bojan Prtvar X-Patchwork-Id: 1033882 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p745T5jO005269 for ; Thu, 4 Aug 2011 05:29:26 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F14FE9E9B2 for ; Wed, 3 Aug 2011 22:29:05 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-fx0-f49.google.com (mail-fx0-f49.google.com [209.85.161.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B42549E76E for ; Wed, 3 Aug 2011 12:52:13 -0700 (PDT) Received: by fxd20 with SMTP id 20so1599153fxd.36 for ; Wed, 03 Aug 2011 12:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=IdT5WluAQ5qyOSvFjItjtOQu03IB3iBoYZA7LnT/uTc=; b=xGMK70JaVErWCLE7nEp0GRtbmG135NEa71KO46PLHPSCSE+oE96lHRzFaiYqEF8X7I C8Nsn/tPr0RZgHPSd44q39rpfJRcQm1uS0iuGEZXEpxq5B9bxORwG5GekoxRUBUqu+sn GMY1pmwDsGgTyYPGivi4vpndBrJIZwmYHquwc= Received: by 10.223.40.198 with SMTP id l6mr8388903fae.14.1312401132437; Wed, 03 Aug 2011 12:52:12 -0700 (PDT) Received: from localhost.localdomain (79-101-199-11.dynamic.isp.telekom.rs [79.101.199.11]) by mx.google.com with ESMTPS id o18sm732386fal.23.2011.08.03.12.52.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 03 Aug 2011 12:52:11 -0700 (PDT) From: Bojan Prtvar To: airlied@linux.ie Subject: [PATCH] Fix potential NULL dereference in drivers/gpu/drm/radeon/atom.c Date: Wed, 3 Aug 2011 21:51:19 +0200 Message-Id: <1312401079-1775-1-git-send-email-prtvar.b@gmail.com> X-Mailer: git-send-email 1.7.1 X-Mailman-Approved-At: Wed, 03 Aug 2011 22:28:14 -0700 Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@redhat.com, akpm@linux-foundation.org, Bojan Prtvar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 04 Aug 2011 05:29:26 +0000 (UTC) kzalloc() can return NULL, so I added check for it Signed-off-by: Bojan Prtvar --- drivers/gpu/drm/radeon/atom.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index ebdb0fd..e88c644 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -1245,6 +1245,9 @@ struct atom_context *atom_parse(struct card_info *card, void *bios) char name[512]; int i; + if (!ctx) + return NULL; + ctx->card = card; ctx->bios = bios;