From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbbJQUdt (ORCPT ); Sat, 17 Oct 2015 16:33:49 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33035 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751855AbbJQUdr (ORCPT ); Sat, 17 Oct 2015 16:33:47 -0400 Subject: Re: [PATCH] mm/maccess.c: actually return -EFAULT from strncpy_from_unsafe To: Rasmus Villemoes , Andrew Morton , "David S. Miller" References: <1445113206-27980-1-git-send-email-linux@rasmusvillemoes.dk> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Namhyung Kim From: Alexei Starovoitov Message-ID: <5622B0AC.1050307@plumgrid.com> Date: Sat, 17 Oct 2015 13:33:48 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1445113206-27980-1-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/15 1:20 PM, Rasmus Villemoes wrote: > As far as I can tell, strncpy_from_unsafe never returns -EFAULT. ret > is the result of a __copy_from_user_inatomic(), which is 0 for success > and positive (in this case necessarily 1) for access error - it is > never negative. So we were always returning the length of the, > possibly truncated, destination string. > > Signed-off-by: Rasmus Villemoes > --- > Probably not -stable-worthy. I can only find two callers, one of which > ignores the return value. good catch. Acked-by: Alexei Starovoitov cc-ing original authors where I copy pasted that part from.