On Wed, Dec 04, 2019 at 04:37:32PM +0100, Johannes Thumshirn wrote: > On Wed, Dec 04, 2019 at 05:17:09PM +0900, Naohiro Aota wrote: > [..] > > > +#define LEN (sizeof(device->fs_info->sb->s_id) + sizeof("(device )") - 1) > > + char devstr[LEN]; > > + const int len = LEN; > > +#undef LEN > > Why not: > const int len = sizeof(device->fs_info->sb->s_id) > + sizeof("(device )") - 1; > char devstr[len]; len is used only once for snprintf to devstr, so there it can be replaced by sizeof(devstr) and the sizeof()+sizeof() can be used for devstr declaration. The size of devstr seems to be one byte shorter than needed: > > + snprintf(devstr, len, " (device %s)", > > + device->fs_info->sb->s_id); There's a leading " " at the begining that I don't see accounted for.