On Thu, Jun 06, 2019 at 08:43:34AM +0000, Naohiro Aota wrote:
[...]
> > +bool btrfs_compress_is_valid_type(const char *str, size_t len)
> > +{
> > + int i;
> > +
> > + for (i = 1; i < ARRAY_SIZE(btrfs_compress_types); i++) {
> > + size_t comp_len = strlen(btrfs_compress_types[i]);
> > +
> > + if (comp_len != len)
>
> Should this be "if (comp_len > len)"?
I thought about this as well and essentiall it is 'comp_len > len' as the
strncmp() later compares up to comp_len anyways. But your're rigth it'll fail
on values like "zlib:9".
Thanks,
Johannes
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@xxxxxxx +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850