Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751500AbbFYL2O (ORCPT ); Thu, 25 Jun 2015 07:28:14 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34702 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751006AbbFYL2G (ORCPT ); Thu, 25 Jun 2015 07:28:06 -0400 Date: Thu, 25 Jun 2015 16:57:58 +0530 From: Sudip Mukherjee To: Dmitry Kalinkin Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Martyn Welch , Greg Kroah-Hartman , Manohar Vanga Subject: Re: [PATCHv2 6/9] staging: vme_user: return -EFAULT on __copy_*_user errors Message-ID: <20150625112758.GB13366@sudip-PC> References: <20150623135124.GP28762@mwanda> <1435075419-28211-1-git-send-email-dmitry.kalinkin@gmail.com> <1435075419-28211-7-git-send-email-dmitry.kalinkin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435075419-28211-7-git-send-email-dmitry.kalinkin@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1296 Lines: 38 On Tue, Jun 23, 2015 at 07:03:36PM +0300, Dmitry Kalinkin wrote: > Signed-off-by: Dmitry Kalinkin > --- > drivers/staging/vme/devices/vme_user.c | 47 ++++++++-------------------------- > 1 file changed, 11 insertions(+), 36 deletions(-) > > @@ -178,38 +167,24 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf, > size_t count, loff_t *ppos) > { > void *image_ptr; > - ssize_t retval; > > image_ptr = image[minor].kern_buf + *ppos; > + if (__copy_to_user(buf, image_ptr, (unsigned long)count)) > + return -EFAULT; > > - retval = __copy_to_user(buf, image_ptr, (unsigned long)count); > - if (retval != 0) { > - retval = (count - retval); > - pr_warn("Partial copy to userspace\n"); > - } else > - retval = count; > - > - /* Return number of bytes successfully read */ > - return retval; > + return count; will it not affect the userspace code? previously number of bytes successfully read was returned, now incase of partial read -EFAULT is being returned. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/