Re: [PATCH v5 02/28] btrfs: Get zone information of zoned block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux