[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcc65c15-b76b-7af1-ca9f-e8818374a329@linux.intel.com>
Date: Thu, 8 Nov 2018 14:15:26 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: "Liu, Yi L" <yi.l.liu@...el.com>, Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>
Cc: baolu.lu@...ux.intel.com, "Raj, Ashok" <ashok.raj@...el.com>,
"Kumar, Sanjay K" <sanjay.k.kumar@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
"Sun, Yi Y" <yi.y.sun@...el.com>,
"peterx@...hat.com" <peterx@...hat.com>,
Jean-Philippe Brucker <jean-philippe.brucker@....com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH v4 04/12] iommu/vt-d: Add 256-bit invalidation descriptor
support
On 11/8/18 1:48 PM, Liu, Yi L wrote:
>> From: Liu, Yi L
>> Sent: Thursday, November 8, 2018 1:45 PM
>>>>>>> + memcpy(desc, qi->desc + (wait_index << shift),
>>>>>>
>>>>>> Would "memcpy(desc, (unsigned long long) (qi->desc + (wait_index
>>>>>> << shift)," be more safe?
>>>>>
>>>>> Can that be compiled? memcpy() requires a "const void *" for the
>>>>> second
>>> parameter.
>>>>> By the way, why it's safer with this casting?
>>>>
>>>> This is just an example. My point is the possibility that "qi->desc
>>>> + (wait_index <<
>>> shift)"
>>>> would be treated as "qi->desc plus (wait_index <<
>>>> shift)*sizeof(*qi->desc)". Is it possible for kernel build?
>>>
>>> qi->desc is of type of "void *".
>>
>> no, I don’t think so... Refer to the code below. Even it has no correctness issue her,
>> It's not due to qi->desc is "void *" type...
>>
>> struct qi_desc {
>> - u64 low, high;
>> + u64 qw0;
>> + u64 qw1;
>> + u64 qw2;
>> + u64 qw3;
>> };
>
> Oops, just see you modified it to be "void *" in this patch. Ok, then this is fair enough.
Yes. :-)
Best regards,
Lu Baolu
Powered by blists - more mailing lists