Re: [PATCH 3/3] nilfs2: move ioctl interface and disk layout to uapi separately

From: Andrew Morton
Date: Tue Jun 14 2016 - 18:29:57 EST


On Mon, 13 Jun 2016 22:45:07 +0900 Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx> wrote:

> The header file "include/linux/nilfs2_fs.h" is composed of parts for
> ioctl and disk format, and both are intended to be shared with user
> space programs.
>
> This moves them to the uapi directory "include/uapi/linux" splitting
> the file to "nilfs2_api.h" and "nilfs2_ondisk.h". The following minor
> changes are accompanied by this migration:
>
> - nilfs_direct_node struct in nilfs2/direct.h is converged to
> nilfs2_ondisk.h because it's an on-disk structure.
> - inline functions nilfs_rec_len_from_disk() and
> nilfs_rec_len_to_disk() are moved to nilfs2/dir.c.
>
> ...
>
> +static inline __le16 nilfs_rec_len_to_disk(unsigned int len)
> +{
> +#if (PAGE_SIZE >= 65536)
> + if (len == (1 << 16))
> + return cpu_to_le16(NILFS_MAX_REC_LEN);
> +
> + BUG_ON(len > (1 << 16));

Is there any way in which the mount of a corrupted filesystem could
trigger this BUG? If so, that would be bad.

> +#endif
> + return cpu_to_le16(len);
> +}