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 attrib operations
Date: Fri, 10 Apr 2026 13:15:25 +0300	[thread overview]
Message-ID: <adjNvTr_3bZmmPfJ@stanley.mountain> (raw)

Hello Konstantin Komarov,

Commit be71b5cba2e6 ("fs/ntfs3: Add attrib operations") from Aug 13,
2021 (linux-next), leads to the following Smatch static checker
warning:

	fs/ntfs3/attrib.c:176 attr_allocate_clusters()
	error: we previously assumed 'pre_alloc' could be null (see line 167)

fs/ntfs3/attrib.c
    160 int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
    161                            struct runs_tree *run_da, CLST vcn, CLST lcn,
    162                            CLST len, CLST *pre_alloc, enum ALLOCATE_OPT opt,
    163                            CLST *alen, const size_t fr, CLST *new_lcn,
    164                            CLST *new_len)
    165 {
    166         int err;
    167         CLST flen, vcn0 = vcn, pre = pre_alloc ? *pre_alloc : 0;
    168         size_t cnt = run->count;
    169 
    170         for (;;) {
    171                 err = ntfs_look_for_free_space(sbi, lcn, len + pre, &lcn, &flen,
    172                                                opt);
    173 
    174                 if (err == -ENOSPC && pre) {
    175                         pre = 0;
--> 176                         if (*pre_alloc)

I'm not sure why warnings from 2021 are showing up as new warnings but
presumably this should be:

	if (pre_alloc)
		*pre_alloc = 0;

    177                                 *pre_alloc = 0;
    178                         continue;
    179                 }
    180 
    181                 if (err == -ENOSPC && new_len && vcn - vcn0) {
    182                         /* Keep already allocated clusters. */
    183                         *alen = vcn - vcn0;

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

regards,
dan carpenter

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:15 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-07-25 11:45 [bug report] fs/ntfs3: Add attrib operations Dan Carpenter
2021-08-24  9:53 Dan Carpenter
2021-08-24  9:42 Dan Carpenter
2021-08-24 10:49 ` Kari Argillander

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=adjNvTr_3bZmmPfJ@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