Message ID | 1542703119-20353-1-git-send-email-amhetre@nvidia.com |
---|---|
State | Deferred |
Headers | show |
Series | kernfs: Add check for NULL pointer before writing to it. | expand |
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 4ca0b5c..76c85a5 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -129,6 +129,9 @@ static int kernfs_path_from_node_locked(struct kernfs_node *kn_to, size_t depth_from, depth_to, len = 0; int i, j; + if (WARN_ON(!buf && buflen > 0)) + return -EINVAL; + if (!kn_to) return strlcpy(buf, "(null)", buflen);