lkml.org 
[lkml]   [2021]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver
From
Date

On 2021/3/10 10:22 上午, Jie Deng wrote:
>
> On 2021/3/4 17:15, Jason Wang wrote:
>>
>>
>>> +        }
>>> +
>>> +        if (msgs[i].flags & I2C_M_RD)
>>> +            memcpy(msgs[i].buf, req->buf, msgs[i].len);
>>
>>
>> Sorry if I had asked this before but any rason not to use msg[i].buf
>> directly?
>>
>>
> The msg[i].buf is passed by the I2C core. I just noticed that these
> bufs are not
> always allocated by kmalloc. They may come from the stack, which may
> cause
> the check "sg_init_one -> sg_set_buf -> virt_addr_valid"  to fail.
> Therefore the
> msg[i].buf is not suitable for direct use here.
>
> Regards.


Right, stack is virtually mapped.

Thanks

\
 
 \ /
  Last update: 2021-03-10 05:00    [W:0.733 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site