Message ID | 20240914102453.3879527-1-Yibin.Ding@unisoc.com |
---|---|
State | New |
Headers | show |
Series | [V2,1/2] interconnect: Add character pointer initialization | expand |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index c6f4a9a98b85..8bbe7df6dfd1 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -970,6 +970,10 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf, return ret; str = *(char **)file->private_data; + if (!str) { + debugfs_file_put(dentry); + return -EINVAL; + } len = strlen(str) + 1; copy = kmalloc(len, GFP_KERNEL); if (!copy) {