From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755327AbcETNHp (ORCPT ); Fri, 20 May 2016 09:07:45 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:35125 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752075AbcETNHn (ORCPT ); Fri, 20 May 2016 09:07:43 -0400 Date: Fri, 20 May 2016 18:37:32 +0530 From: Muhammad Falak R Wani To: Heiko Carstens Cc: Martin Schwidefsky , Jan Kara , "open list:S390" , open list Subject: Re: [PATCH] ks390/keyboard: use memdup_user(). Message-ID: <20160520130732.GA12270@kp> References: <1463746939-23892-1-git-send-email-falakreyaz@gmail.com> <20160520130325.GE3461@osiris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160520130325.GE3461@osiris> 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 On Fri, May 20, 2016 at 03:03:25PM +0200, Heiko Carstens wrote: > On Fri, May 20, 2016 at 05:52:16PM +0530, Muhammad Falak R Wani wrote: > > Use memdup_user to duplicate a memory region from user-space to > > kernel-space, instead of open coding using kmalloc & copy_from_user. > > > > Signed-off-by: Muhammad Falak R Wani > > + p = memdup_user(u_kbs->kb_string, len); > > + if (IS_ERR(p)) > > + return PTR_ERR(p); > > /* > > * Make sure the string is terminated by 0. User could have > > * modified it between us running strnlen_user() and copying it. > > Hi Muhammad, thanks for this patch. However could you change this to use > memdup_user_nul() instead, so we can get rid of even more code? > Should I send V2 with the suggested changes ?