aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinobu Mita <[email protected]>2019-07-31 12:00:06 +0200
committerGreg Kroah-Hartman <[email protected]>2019-08-15 17:38:11 +0200
commitce684d957c5672f3bb55e6b0872932b5b4c39c56 (patch)
treec61d8cf4256800a703287dde5bec8463fad97726
parent9c1c5e0bc5ec032e78bf15c302f3b20152f865ad (diff)
devcoredump: use memory_read_from_buffer
Use memory_read_from_buffer() to simplify devcd_readv(). Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: Akinobu Mita <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/base/devcoredump.c11
1 files changed, 1 insertions, 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)