From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42C12C43603 for ; Wed, 18 Dec 2019 03:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17B7C2146E for ; Wed, 18 Dec 2019 03:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbfLRDua (ORCPT ); Tue, 17 Dec 2019 22:50:30 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7706 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726561AbfLRDua (ORCPT ); Tue, 17 Dec 2019 22:50:30 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DBD97CB89925F0697028; Wed, 18 Dec 2019 11:50:28 +0800 (CST) Received: from huawei.com (10.175.127.16) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Wed, 18 Dec 2019 11:50:18 +0800 From: Pan Zhang To: , , , , , , , , , CC: , , Subject: [PATCH 2/3] gpu: drm: dead code elimination Date: Wed, 18 Dec 2019 11:50:00 +0800 Message-ID: <1576641000-14772-1-git-send-email-zhangpan26@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.127.16] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org this set adds support for removal of gpu drm dead code. patch2: `num_entries` is a data of unsigned type(compilers always treat as unsigned int) and SIZE_MAX == ~0, so there is a impossible condition: '(num_entries > ((~0) - 56) / 72) => (max(0-u32) > 256204778801521549)'. Signed-off-by: Pan Zhang --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index 85b0515..10a7f30 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -71,10 +71,6 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, unsigned i; int r; - if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) - / sizeof(struct amdgpu_bo_list_entry)) - return -EINVAL; - size = sizeof(struct amdgpu_bo_list); size += num_entries * sizeof(struct amdgpu_bo_list_entry); list = kvmalloc(size, GFP_KERNEL); -- 2.7.4