From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:48418 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755040AbcB1XKm (ORCPT ); Sun, 28 Feb 2016 18:10:42 -0500 Date: Sun, 28 Feb 2016 23:10:40 +0000 From: Al Viro To: Amber Thrall Cc: linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/1] fs: strncmp() for user space buffers Message-ID: <20160228231040.GR17997@ZenIV.linux.org.uk> References: <1456699822-2924-1-git-send-email-amber@thrall.me> <20160228230303.GQ17997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160228230303.GQ17997@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Feb 28, 2016 at 11:03:03PM +0000, Al Viro wrote: > On Sun, Feb 28, 2016 at 02:50:22PM -0800, Amber Thrall wrote: > > The simple_strncmp_to_buffer() function provides an easier method for > > developers to compare a kernel space buffer against user space data. This > > process is done in a few drivers and may be simplified to a single function. > > *blink* > > The name is rather confusing and I would say that semantics is unexpected > as well. I would like to see proposed users of that primitive... BTW, such calling conventions are going to breed bugs - it's "0 if equal, something positive if greater, something negative if less, except when returned negative happens to be -EFAULT or -ENOMEM, in which cases it's an error". It would be _very_ easy to get wrong in callers.