Skip to contentSkip to conversation

devcoredump: use memory_read_from_buffer

PATCH New Johannes Berg 1 participant 2 messages Jul 31, 2019

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/2 devcoredump: use memory_read_from_buffer

From: Akinobu Mita <[email protected]>

Use memory_read_from_buffer() to simplify devcd_readv().

---
 drivers/base/devcoredump.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/base/devcoredump.c +1 -10
index f1a3353f3494..3c960a63062f 100644
@@ -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)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 2/2 devcoredump: fix typo in comment

From: Akinobu Mita <[email protected]>

s/dev_coredumpmsg/dev_coredumpsg/ in the kernel-doc

---
 drivers/base/devcoredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/devcoredump.c +1 -1
index 3c960a63062f..e42d0b514384 100644
@@ -314,7 +314,7 @@ void dev_coredumpm(struct device *dev, struct module *owner,
 EXPORT_SYMBOL_GPL(dev_coredumpm);
 
 /**
- * dev_coredumpmsg - create device coredump that uses scatterlist as data
+ * dev_coredumpsg - create device coredump that uses scatterlist as data
  * parameter
  * @dev: the struct device for the crashed device
  * @table: the dump data
Signature · 1 line
2.20.1