lkml.org 
[lkml]   [2023]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 6.5 15/52] fs/ntfs3: Avoid possible memory leak
    Date
    From: Su Hui <suhui@nfschina.com>

    [ Upstream commit e4494770a5cad3c9d1d2a65ed15d07656c0d9b82 ]

    smatch warn:
    fs/ntfs3/fslog.c:2172 last_log_lsn() warn: possible memory leak of 'page_bufs'
    Jump to label 'out' to free 'page_bufs' and is more consistent with
    other code.

    Signed-off-by: Su Hui <suhui@nfschina.com>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/ntfs3/fslog.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
    index 12f28cdf5c838..98ccb66508583 100644
    --- a/fs/ntfs3/fslog.c
    +++ b/fs/ntfs3/fslog.c
    @@ -2168,8 +2168,10 @@ static int last_log_lsn(struct ntfs_log *log)

    if (!page) {
    page = kmalloc(log->page_size, GFP_NOFS);
    - if (!page)
    - return -ENOMEM;
    + if (!page) {
    + err = -ENOMEM;
    + goto out;
    + }
    }

    /*
    --
    2.42.0
    \
     
     \ /
      Last update: 2023-10-29 23:56    [W:4.847 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site