lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACOAw_y1Njm0zswqFXS4EXWcetYAvCGgHpQPqYqaRKh=+JmU8Q@mail.gmail.com>
Date:   Thu, 22 Oct 2020 13:36:58 +0900
From:   Daeho Jeong <daeho43@...il.com>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com,
        Daeho Jeong <daehojeong@...gle.com>
Subject: Re: [f2fs-dev] [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

> The use of ?: here is a bit strange.  How about:
>
>         return algorithm < COMPRESS_MAX && f2fs_cops[algorithm] != NULL;
>

Ack

> Likewise, EINVAL tends to be over-used, which makes it ambiguous.  Maybe use
> ENOPKG for the case where algorithm < COMPRESS_MAX but the algorithm wasn't
> compiled into the kernel?  That would be similar to how opening an encrypted
> file fails with ENOPKG when the encryption algorithm isn't available.

Ack

> How about EBUSY for f2fs_is_mmap_file(inode) || get_dirty_pages(inode),
> and EFBIG for inode->i_size != 0?

Ack

Thanks~!

2020년 10월 22일 (목) 오후 1:26, Eric Biggers <ebiggers@...nel.org>님이 작성:
>
> On Thu, Oct 22, 2020 at 12:58:48PM +0900, Daeho Jeong wrote:
> > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > index 7895186cc765..3b58a41223f8 100644
> > --- a/fs/f2fs/compress.c
> > +++ b/fs/f2fs/compress.c
> > @@ -514,6 +514,11 @@ bool f2fs_is_compress_backend_ready(struct inode *inode)
> >       return f2fs_cops[F2FS_I(inode)->i_compress_algorithm];
> >  }
> >
> > +bool f2fs_is_compress_algorithm_ready(unsigned char algorithm)
> > +{
> > +     return algorithm >= COMPRESS_MAX ? false : f2fs_cops[algorithm];
> > +}
>
> The use of ?: here is a bit strange.  How about:
>
>         return algorithm < COMPRESS_MAX && f2fs_cops[algorithm] != NULL;
>
> > +     if (option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
> > +                     option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
> > +                     !f2fs_is_compress_algorithm_ready(option.algorithm))
> > +             return -EINVAL;
>
> Likewise, EINVAL tends to be over-used, which makes it ambiguous.  Maybe use
> ENOPKG for the case where algorithm < COMPRESS_MAX but the algorithm wasn't
> compiled into the kernel?  That would be similar to how opening an encrypted
> file fails with ENOPKG when the encryption algorithm isn't available.
>
> > +     if (f2fs_is_mmap_file(inode) ||
> > +                     get_dirty_pages(inode) || inode->i_size) {
> > +             ret = -EINVAL;
> > +             goto out;
> > +     }
>
> How about EBUSY for f2fs_is_mmap_file(inode) || get_dirty_pages(inode),
> and EFBIG for inode->i_size != 0?
>
> - Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ