Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753213AbZLXMvz (ORCPT ); Thu, 24 Dec 2009 07:51:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751576AbZLXMvy (ORCPT ); Thu, 24 Dec 2009 07:51:54 -0500 Received: from mail-yx0-f187.google.com ([209.85.210.187]:46947 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbZLXMvx (ORCPT ); Thu, 24 Dec 2009 07:51:53 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=esDdIB/f0PpOn1HE+lGjJio5Aycj7FTPDucsIdE7b8ygkmxjwW5Xw1GRA+4u9tXDHN fLCe93IoP88CP6+JEFZVW7r0SnMPC/ix0sr3TonVPHxujwPnKClh03oEK05v+fEfwpLF BQ6Jyd7378X+lGGAj/9dXx7BvZhiqUeevyAhA= Subject: drivers/gpu/drm/radeon/radeon_fence.c: move a dereference below the NULL test From: Darren Jenkins To: David Airlie , dri-devel mailing list , Kernel Janitors Cc: Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Date: Thu, 24 Dec 2009 23:52:00 +1100 Message-ID: <1261659120.3546.15.camel@ICE-BOX> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1091 Lines: 37 If a NULL value is possible, the dereference should only occur after the NULL test. Coverity CID: 13334 Signed-off-by: Darren Jenkins diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index cb4cd97..f4f5942 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -140,14 +140,14 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence) bool radeon_fence_signaled(struct radeon_fence *fence) { - struct radeon_device *rdev = fence->rdev; unsigned long irq_flags; bool signaled = false; - if (rdev->gpu_lockup) { + if (fence == NULL) { return true; } - if (fence == NULL) { + + if (fence->rdev->gpu_lockup) { return true; } write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/