[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5cfeb7ad11b3783239e05ab7414fcec28dce1b5.camel@sipsolutions.net>
Date: Thu, 02 May 2019 14:42:49 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Akinobu Mita <akinobu.mita@...il.com>,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Keith Busch <keith.busch@...el.com>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>
Subject: Re: [PATCH 1/4] devcoredump: use memory_read_from_buffer
On Thu, 2019-05-02 at 17:59 +0900, Akinobu Mita wrote:
> Use memory_read_from_buffer() to simplify devcd_readv().
Reviewed-by: Johannes Berg <johannes@...solutions.net>
> Cc: Johannes Berg <johannes@...solutions.net>
> Cc: Keith Busch <keith.busch@...el.com>
> Cc: Jens Axboe <axboe@...com>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Sagi Grimberg <sagi@...mberg.me>
> Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
> ---
> drivers/base/devcoredump.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
> index f1a3353..3c960a6 100644
> --- a/drivers/base/devcoredump.c
> +++ b/drivers/base/devcoredump.c
> @@ -164,16 +164,7 @@ static struct class devcd_class = {
> static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count,
> void *data, size_t datalen)
> {
> - if (offset > datalen)
> - return -EINVAL;
> -
> - if (offset + count > datalen)
> - count = datalen - offset;
> -
> - if (count)
> - memcpy(buffer, ((u8 *)data) + offset, count);
> -
> - return count;
> + return memory_read_from_buffer(buffer, count, &offset, data, datalen);
> }
>
> static void devcd_freev(void *data)
Powered by blists - more mailing lists