From: Pan Zhang <zhangpan26@huawei.com>
To: <christian.koenig@amd.com>, <michel@daenzer.net>,
<alexander.deucher@amd.com>, <David1.Zhou@amd.com>,
<airlied@linux.ie>, <daniel@ffwll.ch>, <ray.huang@amd.com>,
<irmoy.das@amd.com>, <sam@ravnborg.org>, <zhangpan26@huawei.com>,
<hushiyuan@huawei.com>
Cc: <amd-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH 2/3] gpu: drm: dead code elimination
Date: Thu, 19 Dec 2019 11:38:31 +0800 [thread overview]
Message-ID: <1576726711-14394-1-git-send-email-zhangpan26@huawei.com> (raw)
In-Reply-To: <484b831b-671a-12f4-8259-1cb6b75e93e3@daenzer.net>
On 2019-12-18 5:52 p.m., Michel Dänzer <michel@daenzer.net> wrote:
>> 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)'.
>While this looks correct for 64-bit, where size_t is unsigned long, on 32-bit it's unsigned int, in which case this isn't dead code.
and
On 2019-12-18 5:52 p.m., Christian König <christian.koenig@xxxxxxx> wrote:
>NAK, that calculation is not correct on 32-bit systems.
>Christian.
Yes, you are right. I just figured this out (because our Server usually uses 64 bits).
thanks.
>>Signed-off-by: Pan Zhang <zhangpan26@xxxxxxxxxx>
>>---
>> 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);
>>
prev parent reply other threads:[~2019-12-19 3:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 3:50 Pan Zhang
2019-12-18 9:52 ` Christian König
2019-12-18 9:52 ` Michel Dänzer
2019-12-19 3:38 ` Pan Zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1576726711-14394-1-git-send-email-zhangpan26@huawei.com \
--to=zhangpan26@huawei.com \
--cc=David1.Zhou@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hushiyuan@huawei.com \
--cc=irmoy.das@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michel@daenzer.net \
--cc=ray.huang@amd.com \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®