Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp410647pxu; Wed, 25 Nov 2020 06:22:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJw26y3v7EivByD43YZEwhD4VSSqQ7ctK4YP3nQKPCN36wgNyhvJE5fxDOLF9BdwSjLUGu/7 X-Received: by 2002:a17:906:5243:: with SMTP id y3mr3366064ejm.273.1606314134824; Wed, 25 Nov 2020 06:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606314134; cv=none; d=google.com; s=arc-20160816; b=cmjdHXR4b8UTEhvJ6bTTDZMNA7eD+8dii3Cjib+xaqMJsn+hxDo45knrmGJyB5yqW+ ypyk5BTT8DKecLWtAK3xw1Azgj9PefmoxHyIOsyx/3a+ErucSM+xGchKeFRkaNogdaId TeQuBmX0FXNTTTmMRFUGOkb44Ii7fggTht4CYpgv7uWc4Ah8zw35grD72TvQcarceaHB eAd3C3TpsfvuLnCQEiGwbfCyyEEY1j86S4VYtYvR79yvsTe7wCV8VZjb/VSZ3POCoH/A YRr4CdqKWRqWty6Mkhs+WxvcrqlquGhleqgGXq/U1XeYIdjdrK2R2e4mkPSAl9aVgtFJ hQug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8pXC/V9yxOKJMIhheyXI7jGVLKA8Yxgf4ktYyg4eRZc=; b=UTZk5yr/TwcUYEt5prSc61FLVSUndCpisBhprTMTXMt+so4UNknNg1cozJozXHBb+J 388+p+cvnSv11w7fInzEWkiJnxa5gpXNqf7YipKq6iqIFRhE+PA9TutBqY8rBamU3dsD uQGdx/b6OPWOhzFRU/7BUyKizequR6LDLzXmLex33xtzjCdTOVY3xd7zoiMxcUTVJM3B e2yIgHT3tpfNUfMGrQeqeqPRxOT4DQ19Sm5BeONnlRymtnDfypi6bMvfkdNaj0jpCPiy uqZqjE6hi0hhbG1yxO0WiCoa1/ixrlMrZkGKLi+4N1Y7HyL1EyVrhF3+6E6MO0xcqmcS 5Q8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si1338711eji.658.2020.11.25.06.21.50; Wed, 25 Nov 2020 06:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730003AbgKYOSN (ORCPT + 99 others); Wed, 25 Nov 2020 09:18:13 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:40072 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729847AbgKYOSN (ORCPT ); Wed, 25 Nov 2020 09:18:13 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1khvcU-0001hB-PX; Wed, 25 Nov 2020 14:18:06 +0000 From: Colin King To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Daniel Vetter , Tao Zhou , Guchun Chen , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] drm/amdgpu: Fix sizeof() mismatch in bps_bo kmalloc_array creation Date: Wed, 25 Nov 2020 14:18:06 +0000 Message-Id: <20201125141806.1881036-1-colin.king@canonical.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King An incorrect sizeof() is being used, sizeof((*data)->bps_bo) is not correct, it should be sizeof(*(*data)->bps_bo). It just so happens to work because the sizes are the same. Fix it. Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)") Fixes: 5278a159cf35 ("drm/amdgpu: support reserve bad page for virt (v3)") Signed-off-by: Colin Ian King --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 2d51b7694d1f..df15d33e3c5c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -283,7 +283,7 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) return -ENOMEM; bps = kmalloc_array(align_space, sizeof((*data)->bps), GFP_KERNEL); - bps_bo = kmalloc_array(align_space, sizeof((*data)->bps_bo), GFP_KERNEL); + bps_bo = kmalloc_array(align_space, sizeof(*(*data)->bps_bo), GFP_KERNEL); if (!bps || !bps_bo) { kfree(bps); -- 2.29.2