fs/ocfs2: change %8s to %s for mlog of ocfs2_sb_probe
PATCH 1/1 fs/ocfs2: change %8s to %s for mlog of ocfs2_sb_probe
In reply to a message not in the archiveQuoted 5 lines · Chen Gang
at least, the
hdr->signaturelen is 9 (OCFS1_VOLUME_SIGNATURE)at ocfs1_fs_compat.h:39: #define OCFS1_VOLUME_SIGNATURE "OracleCFS"so change %8s to %s
Ok, good catch - OCFS1_VOLUME_SIGNATURE is 9 bytes wide. And yes, the ->signature field in ocfs1_vol_disk_hdr is 64 bytes wide so we would always hit a NULL byte in a valid ocfs1 disk header.
Quoted 7 lines
additional information:
%8s limit the width, not for the original string output length
if name length is more than 8, it still can be fully displayed. if name length is less than 8, the ' ' will be filled before name.%.8s truly limit the original string output length (precision)
However, we can't guarantee that the block will always contain a valid ocfs1 disk header, with a valid signature field. So we have to still limit the print, otherwise we could go off the end of our struct if the data read is garbage (which is exacly what this check is supposed to catch).
I think that instead we should simply change the %8s to %9s.
--Mark
--
Mark Fasheh