Re: [RFC][PATCH v3 01/10] fs: common implementation of file type

From: Al Viro
Date: Wed Oct 24 2018 - 08:37:44 EST


On Tue, Oct 23, 2018 at 09:19:53PM +0100, Phillip Potter wrote:

> +static inline unsigned char fs_dtype(int filetype)

That "int" is asking for trouble, especially since negative
argument will blow up. And it comes from untrusted source...

> +{
> + if (filetype >= FT_MAX)
> + return DT_UNKNOWN;
> +
> + return fs_dtype_by_ftype[filetype];
> +}