lkml.org 
[lkml]   [2019]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] fs: kernfs: Fix possible null-pointer dereferences in kernfs_path_from_node_locked()
    On Wed, Jul 24, 2019 at 10:22:42AM +0800, Jia-Ju Bai wrote:
    > In kernfs_path_from_node_locked(), there is an if statement on line 147
    > to check whether buf is NULL:
    > if (buf)
    >
    > When buf is NULL, it is used on line 151:
    > len += strlcpy(buf + len, parent_str, ...)
    > and line 158:
    > len += strlcpy(buf + len, "/", ...)
    > and line 160:
    > len += strlcpy(buf + len, kn->name, ...)
    >
    > Thus, possible null-pointer dereferences may occur.
    >
    > To fix these possible bugs, buf is checked before being used.
    > If it is NULL, -EINVAL is returned.
    >
    > These bugs are found by a static analysis tool STCheck written by us.

    Can we just get rid of the NULL testing?

    Thanks.

    --
    tejun

    \
     
     \ /
      Last update: 2019-07-29 20:52    [W:4.137 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site