[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241004141037.43277-1-surajsonawane0215@gmail.com>
Date: Fri, 4 Oct 2024 19:40:37 +0530
From: SurajSonawane2415 <surajsonawane0215@...il.com>
To: hch@...radead.org
Cc: axboe@...nel.dk,
linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
surajsonawane0215@...il.com
Subject: Explanation on Uninitialized Variable bio in blk_rq_prep_clone
Explaination of how bio could be used uninitialized in this function:
In the function blk_rq_prep_clone, the variable bio is declared but can remain uninitialized
if the allocation with bio_alloc_clone fails. This can lead to undefined behavior when the
function attempts to free bio in the error handling section using bio_put(bio).
By initializing bio to NULL at declaration, we ensure that the cleanup code will only
interact with bio if it has been successfully allocated.
Best regards,
Suraj Sonawane
Powered by blists - more mailing lists