Page MenuHomeFreeBSD

D38420.diff
No OneTemporary

D38420.diff

diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -425,9 +425,11 @@
static ssize_t
-fops_blob_read(struct file *filp, char __user *ubuf, size_t read_size, loff_t *ppos)
+fops_blob_read(struct file *filp, char *ubuf, size_t read_size, loff_t *ppos)
{
struct debugfs_blob_wrapper *blob;
+ size_t buf_remain;
+ ssize_t num_read;
blob = filp->private_data;
if (blob == NULL)
@@ -435,7 +437,14 @@
if (blob->size == 0 || blob->data == NULL)
return (-EINVAL);
- return (simple_read_from_buffer(ubuf, read_size, ppos, blob->data, blob->size));
+ if (*ppos < 0 || *ppos > blob->size)
+ return (-EINVAL);
+
+ buf_remain = blob->size - *ppos;
+ num_read = MIN(read_size, buf_remain);
+ memcpy(ubuf, (char *)blob->data + *ppos, num_read);
+ *ppos += num_read;
+ return (num_read);
}
static int

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 27, 3:29 PM (6 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16200031
Default Alt Text
D38420.diff (929 B)

Event Timeline