public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev
Subject: [bug report] fs/ntfs3: add delayed-allocation (delalloc) support
Date: Fri, 10 Apr 2026 09:00:31 +0300	[thread overview]
Message-ID: <adiR_6B7IpUDjGSh@stanley.mountain> (raw)

Hello Konstantin Komarov,

Commit 10d7c95af043 ("fs/ntfs3: add delayed-allocation (delalloc)
support") from Feb 16, 2026 (linux-next), leads to the following
Smatch static checker warning:

	fs/ntfs3/frecord.c:3303 ni_allocate_da_blocks_locked()
	error: uninitialized symbol 'err'.

fs/ntfs3/frecord.c
    3268 int ni_allocate_da_blocks_locked(struct ntfs_inode *ni)
    3269 {
    3270         int err;
    3271 
    3272         if (!ni->file.run_da.count)
    3273                 return 0;
    3274 
    3275         if (is_sparsed(ni)) {
    3276                 CLST vcn, lcn, clen, alen;
    3277                 bool new;
    3278 
    3279                 /*
    3280                  * Sparse file allocates clusters in 'attr_data_get_block_locked'
    3281                  */
    3282                 while (run_get_entry(&ni->file.run_da, 0, &vcn, &lcn, &clen)) {

Do we always enter this loop for at least on iteration?  Otherwise ...

    3283                         /* TODO: zero=true? */
    3284                         err = attr_data_get_block_locked(ni, vcn, clen, &lcn,
    3285                                                          &alen, &new, true,
    3286                                                          NULL, true);
    3287                         if (err)
    3288                                 break;
    3289                         if (!new) {
    3290                                 err = -EINVAL;
    3291                                 break;
    3292                         }
    3293                 }
    3294         } else {
    3295                 /*
    3296                  * Normal file allocates clusters in 'attr_set_size'
    3297                  */
    3298                 err = attr_set_size_ex(ni, ATTR_DATA, NULL, 0, &ni->file.run,
    3299                                        ni->vfs_inode.i_size, &ni->i_valid,
    3300                                        false, NULL, true);
    3301         }
    3302 
--> 3303         return err;

err would be uninitialized

    3304 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10  6:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=adiR_6B7IpUDjGSh@stanley.mountain \
    --to=error27@gmail.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