mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li zeming <zeming@nfschina.com>
To: willy@infradead.org, jlayton@kernel.org, song@kernel.org,
	bvanassche@acm.org, neilb@suse.de
Cc: reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Li zeming <zeming@nfschina.com>
Subject: [PATCH] reiserfs: journal: Increase jl pointer check
Date: Tue, 25 Oct 2022 16:47:04 +0800	[thread overview]
Message-ID: <20221025084704.3922-1-zeming@nfschina.com> (raw)

If kzalloc fails to allocate the jl pointer, NULL is returned directly.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 fs/reiserfs/journal.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 94addfcefede..d64e9de126c1 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2569,6 +2569,9 @@ static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s)
 	struct reiserfs_journal_list *jl;
 	jl = kzalloc(sizeof(struct reiserfs_journal_list),
 		     GFP_NOFS | __GFP_NOFAIL);
+	if (!jl)
+		return NULL;
+
 	INIT_LIST_HEAD(&jl->j_list);
 	INIT_LIST_HEAD(&jl->j_working_list);
 	INIT_LIST_HEAD(&jl->j_tail_bh_list);
-- 
2.18.2


             reply	other threads:[~2022-10-25  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25  8:47 Li zeming [this message]
2022-10-25 21:30 ` NeilBrown
2022-10-26  1:47   ` Li zeming
2022-10-26  3:05     ` NeilBrown
2022-10-26  3:55       ` Li zeming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221025084704.3922-1-zeming@nfschina.com \
    --to=zeming@nfschina.com \
    --cc=bvanassche@acm.org \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®