Page MenuHomeFreeBSD

D38420.1795953956.diff
No OneTemporary

Authored By
Unknown
Size
929 B
Referenced Files
None
Subscribers
None

D38420.1795953956.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
Sun, Nov 29, 12:05 PM (7 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42089471
Default Alt Text
D38420.1795953956.diff (929 B)

Event Timeline