[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db9350b3-b847-8f54-546f-9a0bdec425d4@intel.com>
Date: Wed, 10 Mar 2021 10:22:30 +0800
From: Jie Deng <jie.deng@...el.com>
To: Jason Wang <jasowang@...hat.com>, linux-i2c@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Cc: mst@...hat.com, wsa@...nel.org, wsa+renesas@...g-engineering.com,
andriy.shevchenko@...ux.intel.com, conghui.chen@...el.com,
arnd@...db.de, kblaiech@...lanox.com,
jarkko.nikula@...ux.intel.com, Sergey.Semin@...kalelectronics.ru,
rppt@...nel.org, loic.poulain@...aro.org, tali.perry1@...il.com,
u.kleine-koenig@...gutronix.de, bjorn.andersson@...aro.org,
yu1.wang@...el.com, shuo.a.liu@...el.com, viresh.kumar@...aro.org,
stefanha@...hat.com, pbonzini@...hat.com
Subject: Re: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver
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.
Powered by blists - more mailing lists