Skip to contentSkip to conversation

ntfs: update attrib operations

bug report Dan Carpenter 1 participant 1 message Apr 10 VFS

lore
Share & tools
lore
#0 lore 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