dm-verity: fix unreliable memory allocation
Mikulas Patocka
maintainerPATCH 1/1 dm-verity: fix unreliable memory allocation
GFP_NOWAIT allocation may fail anytime. It needs to be changed to GFP_NOIO. There's no need to handle an error because mempool_alloc with GFP_NOIO can't fail.
Signed-off-by Mikulas Patocka <[email protected]>
--- drivers/md/dm-verity-fec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/md/dm-verity-fec.c +1 -5
@@ -320,11 +320,7 @@ static int fec_alloc_bufs(struct dm_veriif (fio->bufs[n])continue ; - fio->bufs[n] =mempool_alloc (&v->fec->prealloc_pool,GFP_NOWAIT ); -if (unlikely (!fio->bufs[n])) { -DMERR ("failed to allocate FEC buffer" ); -return -ENOMEM ; - } + fio->bufs[n] =mempool_alloc (&v->fec->prealloc_pool,GFP_NOIO ); }/* try to allocate the maximum number of buffers */
Quoted 6 lines · Mikulas Patocka
GFP_NOWAITallocation may fail anytime. It needs to be changed toGFP_NOIO. There's no need to handle an error becausemempool_allocwithGFP_NOIOcan't fail.Signed-off-by Mikulas Patocka <[email protected]>
Reviewed-by Eric Biggers <[email protected]>
- Eric