]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - lib/test_hmm.c
lib: fix test_hmm.c reference after free
authorRandy Dunlap <rdunlap@infradead.org>
Fri, 26 Jun 2020 03:29:43 +0000 (20:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Jun 2020 07:27:37 +0000 (00:27 -0700)
commit786ae133e07f2a6b352a0efad16b555ee45a2898
tree5f0ff094c1b2278709781016721487fd657f7d91
parent9277f8334ffc719fe922d776444d6e4e884dbf30
lib: fix test_hmm.c reference after free

Coccinelle scripts report the following errors:

  lib/test_hmm.c:523:20-26: ERROR: reference preceded by free on line 521
  lib/test_hmm.c:524:21-27: ERROR: reference preceded by free on line 521
  lib/test_hmm.c:523:28-35: ERROR: devmem is NULL but dereferenced.
  lib/test_hmm.c:524:29-36: ERROR: devmem is NULL but dereferenced.

Fix these by using the local variable 'res' instead of devmem.

Link: http://lkml.kernel.org/r/c845c158-9c65-9665-0d0b-00342846dd07@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/test_hmm.c