Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • samples
  • livepatch
  • livepatch-shadow-fix2.c
Find file BlameHistoryPermalink
  • Tom Rix's avatar
    livepatch: Reorder to use before freeing a pointer · 5e6ded2e
    Tom Rix authored Mar 19, 2022
    
    
    Clang static analysis reports this issue
    livepatch-shadow-fix1.c:113:2: warning: Use of
      memory after it is freed
      pr_info("%s: dummy @ %p, prevented leak @ %p\n",
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The pointer is freed in the previous statement.
    Reorder the pr_info to report before the free.
    
    Similar issue in livepatch-shadow-fix2.c
    
    Note that it is a false positive. pr_info() just prints the address.
    The freed memory is not accessed. Well, the static analyzer could not
    know this easily.
    
    Signed-off-by: default avatarTom Rix <trix@redhat.com>
    Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
    Acked-by: default avatarDavid Vernet <void@manifault.com>
    Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
    [pmladek@suse.com: Note about that it was false positive.]
    Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
    Link: https://lore.kernel.org/r/20220320015143.2208591-1-trix@redhat.com
    5e6ded2e
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7