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
  • kernel
  • bpf
  • arraymap.c
Find file BlameHistoryPermalink
  • Alexei Starovoitov's avatar
    bpf: fix arraymap NULL deref and missing overflow and zero size checks · daaf427c
    Alexei Starovoitov authored Nov 18, 2014
    
    
    - fix NULL pointer dereference:
    kernel/bpf/arraymap.c:41 array_map_alloc() error: potential null dereference 'array'.  (kzalloc returns null)
    kernel/bpf/arraymap.c:41 array_map_alloc() error: we previously assumed 'array' could be null (see line 40)
    
    - integer overflow check was missing in arraymap
    (hashmap checks for overflow via kmalloc_array())
    
    - arraymap can round_up(value_size, 8) to zero. check was missing.
    
    - hashmap was missing zero size check as well, since roundup_pow_of_two() can
    truncate into zero
    
    - found a typo in the arraymap comment and unnecessary empty line
    
    Fix all of these issues and make both overflow checks explicit U32 in size.
    
    Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    daaf427c
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7