From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:56892 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbeJXVFj (ORCPT ); Wed, 24 Oct 2018 17:05:39 -0400 Date: Wed, 24 Oct 2018 13:37:40 +0100 From: Al Viro To: Phillip Potter Cc: linux-kernel@vger.kernel.org, amir73il@gmail.com, linux-fsdevel@vger.kernel.org Subject: Re: [RFC][PATCH v3 01/10] fs: common implementation of file type Message-ID: <20181024123740.GA32577@ZenIV.linux.org.uk> References: <20181023201953.GA15687@pathfinder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181023201953.GA15687@pathfinder> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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]; > +}