All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] ntfs: update attrib operations
Date: Fri, 10 Apr 2026 13:11:28 +0300	[thread overview]
Message-ID: <adjM0PIEaYLUe5NS@stanley.mountain> (raw)

Hello Namjae Jeon,

Commit 495e90fa3348 ("ntfs: update attrib operations") from Feb 13,
2026 (linux-next), leads to the following Smatch static checker
warning:

	fs/ntfs/compress.c:1377 ntfs_write_cb()
	warn: should bitwise negate be 'llong'?

fs/ntfs/compress.c
    1274 static int ntfs_write_cb(struct ntfs_inode *ni, loff_t pos, struct page **pages,
    1275                 int pages_per_cb)
    1276 {

[ snip ]

    1363         if (!fail && !allzeroes) {
    1364                 outbuf[compsz++] = 0;
    1365                 outbuf[compsz++] = 0;
    1366                 rounded = ((compsz - 1) | (vol->cluster_size - 1)) + 1;
    1367                 memset(&outbuf[compsz], 0, rounded - compsz);
    1368                 bio_size = rounded;
    1369                 pages = pages_disk;
    1370         } else if (allzeroes) {
    1371                 err = 0;
    1372                 goto out;
    1373         } else {
    1374                 bio_size = insz;
    1375         }
    1376 
--> 1377         new_vcn = ntfs_bytes_to_cluster(vol, pos & ~(ni->itype.compressed.block_size - 1));

This should be ~(loff_t)(ni->itype.compressed.block_size - 1).  Otherwise
it zeroes out everything higher than 32 bits.

    1378         new_length = ntfs_bytes_to_cluster(vol, round_up(bio_size, vol->cluster_size));
    1379 
    1380         err = ntfs_non_resident_attr_punch_hole(ni, new_vcn, ni->itype.compressed.block_clusters);
    1381         if (err < 0)
    1382                 goto out;
    1383 
    1384         rlc = ntfs_cluster_alloc(vol, new_vcn, new_length, -1, DATA_ZONE,
    1385                         false, true, true);
    1386         if (IS_ERR(rlc)) {
    1387                 err = PTR_ERR(rlc);
    1388                 goto out;
    1389         }

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

regards,
dan carpenter

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:11 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-10  6:46 [bug report] ntfs: update attrib operations Dan Carpenter
2026-02-27  7:58 Dan Carpenter
2026-02-27  9:46 ` Namjae Jeon

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=adjM0PIEaYLUe5NS@stanley.mountain \
    --to=error27@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.