mm/hmm/test: Fix an error code in dmirror_allocate_chunk()
PATCH 1/1 mm/hmm/test: Fix an error code in dmirror_allocate_chunk()
This is supposed to return false on failure, not a negative error code.
Fixes 170e38548b81 ("mm/hmm/test: use after free in dmirror_allocate_chunk()")
Signed-off-by Dan Carpenter <[email protected]>
---
I messed this up earlier... My devel version of Smatch prints too much garbage so I missed the warning when I first wrote the patch. :/ Sorry.
lib/test_hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_hmm.c +1 -1
@@ -461,7 +461,7 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, devmem =kzalloc (sizeof (*devmem),GFP_KERNEL );if (!devmem) -return -ENOMEM ; +return false; res =request_free_mem_region (&iomem_resource,DEVMEM_CHUNK_SIZE ,"hmm_dmirror" );
Signature · 1 line
2.28.0
Quoted 17 lines · Dan Carpenter
This is supposed to return false on failure, not a negative error code.
Fixes 170e38548b81 ("mm/hmm/test: use after free in dmirror_allocate_chunk()")Signed-off-by Dan Carpenter <[email protected]>---
I messed this up earlier... My devel version of Smatch prints too much garbage so I missed the warning when I first wrote the patch. :/ Sorry.lib/test_hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/test_hmm.c +0
-0
lib/test_hmm.c static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, · line 467
Quoted 8 lines
lib/test_hmm.c +1
-1@@ -461,7 +461,7 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, devmem =kzalloc (sizeof (*devmem),GFP_KERNEL );if (!devmem) -return -ENOMEM ; +return false; res =request_free_mem_region (&iomem_resource,DEVMEM_CHUNK_SIZE ,"hmm_dmirror" );
Thanks for fixing this.
Reviewed-by Ralph Campbell <[email protected]>