Skip to contentSkip to conversation

NFSv4/flexfiles: Update low level helper functions to be DS stripe aware.

bug report Dan Carpenter 1 participant 1 message Sep 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Jonathan Curley,

This is a semi-automatic email about new static checker warnings.

Commit e142d1137b17 ("NFSv4/flexfiles: Update low level helper functions to be DS stripe aware.") from Aug 25, 2025, leads to the following Smatch complaint:

fs/nfs/flexfilelayout/flexfilelayoutdev.c:598 ff_rw_layout_has_available_ds()
warn: variable dereferenced before check 'mirror' (see line 597)

fs/nfs/flexfilelayout/flexfilelayoutdev.c
596 mirror = FF_LAYOUT_COMP(lseg, idx);

   597			for (dss_id = 0; dss_id < mirror->dss_count; dss_id++) {
                                                  ^^^^^^^^

Dereference

598 if (!mirror || IS_ERR(mirror->dss[dss_id].mirror_ds))

                                    ^^^^^^^

NULL check is too late.

599 return false;
600 if (!mirror->dss[dss_id].mirror_ds)

regards,
dan carpenter