public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: almaz.alexandrovich@paragon-software.com
Cc: ntfs3@lists.linux.dev
Subject: [bug report] fs/ntfs3: Add initialization of super block
Date: Tue, 24 Aug 2021 10:58:19 +0300	[thread overview]
Message-ID: <20210824075819.GA13628@kili> (raw)

Hello Konstantin Komarov,

The patch 82cae269cfa9: "fs/ntfs3: Add initialization of super block"
from Aug 13, 2021, leads to the following
Smatch static checker warning:

	fs/ntfs3/index.c:238 bmp_buf_get()
	warn: 'bh' could be an error pointer

fs/ntfs3/index.c
    229 	data_size = le64_to_cpu(b->nres.data_size);
    230 	if (WARN_ON(off >= data_size)) {
    231 		/* looks like filesystem error */
    232 		return -EINVAL;
    233 	}
    234 
    235 	valid_size = le64_to_cpu(b->nres.valid_size);
    236 
    237 	bh = ntfs_bread_run(sbi, &indx->bitmap_run, off);
--> 238 	if (!bh)
    239 		return -EIO;
    240 
    241 	if (IS_ERR(bh))

This is not a bug, but it is wrong style.  When a function returns both
error pointers and NULL then the NULL return is means the feature is
disabled.  It's not an error.  Just that the feature is turned off
deliberately in the Kconfig or whatever.  Don't print an error message,
just continue with the feature disabled as the admin has requested.

But here NULL is just an error.  The ntfs_bread_run() should do:

	bh = ntfs_bread();
	if (!bh)
		return ERR_PTR(-EIO);
	return bh;

    242 		return PTR_ERR(bh);
    243 
    244 	bbuf->bh = bh;
    245 

regards,
dan carpenter

             reply	other threads:[~2021-08-24  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  7:58 Dan Carpenter [this message]
2021-08-24 10:33 ` [bug report] fs/ntfs3: Add initialization of super block Kari Argillander
2026-02-09 15:24 ` [PATCH] fs/ntfs3: avoid calling run_get_entry() when run == NULL in ntfs_read_run_nb_ra() Konstantin Komarov
     [not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
2026-02-06 13:41 ` [bug report] fs/ntfs3: Add initialization of super block Dan Carpenter
2026-02-09 10:20   ` Konstantin Komarov

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=20210824075819.GA13628@kili \
    --to=dan.carpenter@oracle.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=ntfs3@lists.linux.dev \
    /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