Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108584053
D38420.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
929 B
Referenced Files
None
Subscribers
None
D38420.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D38420: lindebugfs: Update fops_blob_read to operate on a kernel pointer.
Attached
Detach File
Event Timeline
Log In to Comment