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
You need to sign in or sign up before continuing.
  • linux
  • drivers
  • net
  • netdevsim
  • dev.c
Find file BlameHistoryPermalink
  • Dan Carpenter's avatar
    netdevsim: fix uninitialized data in nsim_dev_trap_fa_cookie_write() · f72207a5
    Dan Carpenter authored Jul 11, 2023
    The simple_write_to_buffer() function is designed to handle partial
    writes.  It returns negatives on error, otherwise it returns the number
    of bytes that were able to be copied.  This code doesn't check the
    return properly.  We only know that the first byte is written, the rest
    of the buffer might be uninitialized.
    
    There is no need to use the simple_write_to_buffer() function.
    Partial writes are prohibited by the "if (*ppos != 0)" check at the
    start of the function.  Just use memdup_user() and copy the whole
    buffer.
    
    Fixes: d3cbb907
    
     ("netdevsim: add ACL trap reporting cookie as a metadata")
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Link: https://lore.kernel.org/r/7c1f950b-3a7d-4252-82a6-876e53078ef7@moroto.mountain
    
    
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    f72207a5
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7