[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190731100007.32684-1-johannes@sipsolutions.net>
Date: Wed, 31 Jul 2019 12:00:06 +0200
From: Johannes Berg <johannes@...solutions.net>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
Akinobu Mita <akinobu.mita@...il.com>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Subject: [PATCH 1/2] devcoredump: use memory_read_from_buffer
From: Akinobu Mita <akinobu.mita@...il.com>
Use memory_read_from_buffer() to simplify devcd_readv().
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Reviewed-by: Johannes Berg <johannes@...solutions.net>
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
Link: https://lore.kernel.org/r/1564243146-5681-2-git-send-email-akinobu.mita@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@...el.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 f1a3353f3494..3c960a63062f 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)
--
2.20.1
Powered by blists - more mailing lists