Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp861469ybl; Fri, 30 Aug 2019 08:12:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhaeon8cs0kvNrOA0L9pXrFN6d4d+zXjluzCPsqZ8N5VckgUcwtcPUXRJajt3lB3ee3wRJ X-Received: by 2002:aa7:842f:: with SMTP id q15mr18663395pfn.250.1567177949777; Fri, 30 Aug 2019 08:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567177949; cv=none; d=google.com; s=arc-20160816; b=BOxZu6xxUBVKnOtp96AT/dyCd27SF2LoPG3wfVYa6bU48835JFOCxfgYRXkG+3hpgo JKCsNShsEb1CYcfU7R5D68qxjFXlUFx0nf5HybLtkT+erLqhOq4W53o4vO0+Vv28ZDV2 G68KwA+sGAGBiqD9F3GSBVdhZO5ryeiAH4BZBXXK4TbdmoMgUohJwrMvUbMfA2LxrG9M WBQhOS8L7N8K3BIhvLC/1bHoLry1cyAi54jGFI7J/j12PJh/BdJMSIbiCv0HyJYrMoIA wilm1092iKXzKTSXktsc+mkxktdbrEKYAlOYCNAG7HjkCa+BiiDn9p54mc+8kivJb7c0 xFMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IX37xBGf5R5k6PbsX8zWqg1WxUYZJX8p+B51wVl4L5c=; b=qDyIsQwZk/mjZiIYVO59VAYb95V3YKnN5QiBOLHWzsnPA419lVwNSqKa+ZvXxMHgKX K/MWAdLwG1VFk3qrloyFLlUPl3FACLQff/lyn2y7DZ3b3QjUuQjO3YUYTrQbAA4VhGo0 elExF2UBlQ2zJATOmPHjPOulaGvXX8TkXb8Nn8Yo+WUdmPeT9ywzr9r8Qc5ixs9xqf3h tt/cBU6u7k2cbUwzllAcnLtZHhJvcZ9Dq7ZJ70idMBwctYb3PxeiE0PsNaGRAyFk3QNf xGKTMARkl9CjxzRBS8/sNyaVi7W/2HLJVmRcmQfb93csued2nxjifZDVzb/dzMr6DwIt g6Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q36KFh9F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si4733340plp.4.2019.08.30.08.12.14; Fri, 30 Aug 2019 08:12:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q36KFh9F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728509AbfH3PKF (ORCPT + 99 others); Fri, 30 Aug 2019 11:10:05 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46194 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728463AbfH3PKA (ORCPT ); Fri, 30 Aug 2019 11:10:00 -0400 Received: by mail-wr1-f65.google.com with SMTP id h7so5985713wrt.13 for ; Fri, 30 Aug 2019 08:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IX37xBGf5R5k6PbsX8zWqg1WxUYZJX8p+B51wVl4L5c=; b=q36KFh9FWXeiY7g0nLMvI/C8mlM9r6+D7Pq1xIxoB4DYMyN3UJNWG1qQbbXyBj90w4 j6TBYQEcVNvNYbRKrHUydZ+Ftz1xUB9yoRW5NvDlliv5GoD90h/oOXxzgBfKKZdVV883 c9xOUk2sVtI+M8K6+4nUA+dfyr/Bci3jUglrB5CpaGLw0BlCH8bya8kEOxGxQsSlJOEF QUCxobPT0A6LguDpYz0FFZeqCw9F6aU5Hxav/NPi5Ci1Y6XwUjL6h9gfkIZeorZQkgx0 Vb/an/BD/1au+NHGmQUdTSq87ZrC4DihinhaWnj9lZRSdTN5sTOXfg9+KIBqpxinXbV7 xVzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IX37xBGf5R5k6PbsX8zWqg1WxUYZJX8p+B51wVl4L5c=; b=DC18jusB70sTXd6Xg7TLYmUtYc18UDJKmdcpM2dRFKh+l4/wPQ8Umztpk6eQs2FYQC 3Pel7EIPk9iARvr9rtj7ab5vN4R0eDjHOSK+sb1fDT8J84iUVVKjVVVmJTpNlYszXKYl 0PrTACYT5cP00S47+zh99ZeyOREAf5wkndJ4VaGaU2vPwlL1GwNoz4dy5S5kVD3q0G++ QruJOnOVMfBLF+IW7e2z2QlEeOme9L249B0Mt7d5Y8RpSCZDnQWlj/yM6Uq0duJhifHf IaJUTLDkADKhOcMWgx9pAHqpp3+A8ElxQ48x38hOqHldSy8w6WEv1AsbEMH/RIUlpfIS aAMw== X-Gm-Message-State: APjAAAUUVlKQln6JHVk3LNpeZU64jST7TYDXU143yx0SEh1hVi4xv+wZ icX2TKBFYW3kZ4GwAb3nOQnAWXs/1Y1RffxU58s= X-Received: by 2002:adf:8004:: with SMTP id 4mr18038118wrk.341.1567177798350; Fri, 30 Aug 2019 08:09:58 -0700 (PDT) MIME-Version: 1.0 References: <20190830080704.GA29599@LGEARND20B15> In-Reply-To: <20190830080704.GA29599@LGEARND20B15> From: Alex Deucher Date: Fri, 30 Aug 2019 11:09:43 -0400 Message-ID: Subject: Re: [PATCH] drm/amdgpu: Move null pointer dereference check To: Austin Kim Cc: Rex Zhu , "Quan, Evan" , Maling list - DRI developers , amd-gfx list , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 8:43 AM Austin Kim wrote: > > Null pointer dereference check should have been checked, > ahead of below routine. > struct amdgpu_device *adev = hwmgr->adev; > > With this commit, it could avoid potential NULL dereference. > > Signed-off-by: Austin Kim Applied. thanks! Alex > --- > drivers/gpu/drm/amd/powerplay/smumgr/smu8_smumgr.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu8_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu8_smumgr.c > index 8189fe4..4728aa2 100644 > --- a/drivers/gpu/drm/amd/powerplay/smumgr/smu8_smumgr.c > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu8_smumgr.c > @@ -722,16 +722,17 @@ static int smu8_request_smu_load_fw(struct pp_hwmgr *hwmgr) > > static int smu8_start_smu(struct pp_hwmgr *hwmgr) > { > - struct amdgpu_device *adev = hwmgr->adev; > + struct amdgpu_device *adev; > > uint32_t index = SMN_MP1_SRAM_START_ADDR + > SMU8_FIRMWARE_HEADER_LOCATION + > offsetof(struct SMU8_Firmware_Header, Version); > > - > if (hwmgr == NULL || hwmgr->device == NULL) > return -EINVAL; > > + adev = hwmgr->adev; > + > cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index); > hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA); > pr_info("smu version %02d.%02d.%02d\n", > -- > 2.6.2 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx