fix: the bug about rwbuffer causing mem overflow
when the offest from rwb->wrblockstart to startblock plus rwb->wrnblocks is greater than rwb->wralignblocks, it will be causing memory overflow since rwb->wrbuffer is allocated rwb.wrmaxblock(rwb.wralignblocks) blocks.
This commit is contained in:
parent
ebcf25b2f6
commit
e43aa99ae8
@ -819,7 +819,7 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
|
|||||||
|
|
||||||
/* Allocate the write buffer */
|
/* Allocate the write buffer */
|
||||||
|
|
||||||
allocsize = rwb->wrmaxblocks * rwb->blocksize;
|
allocsize = rwb->wrmaxblocks * rwb->blocksize * 2;
|
||||||
rwb->wrbuffer = kmm_malloc(allocsize);
|
rwb->wrbuffer = kmm_malloc(allocsize);
|
||||||
if (!rwb->wrbuffer)
|
if (!rwb->wrbuffer)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user