From owner-svn-src-head@FreeBSD.ORG Wed Sep 19 11:54:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0C1A106564A; Wed, 19 Sep 2012 11:54:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5F58FC16; Wed, 19 Sep 2012 11:54:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8JBsXOP086017; Wed, 19 Sep 2012 11:54:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8JBsXCU086015; Wed, 19 Sep 2012 11:54:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209191154.q8JBsXCU086015@svn.freebsd.org> From: John Baldwin Date: Wed, 19 Sep 2012 11:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240692 - head/sys/dev/amr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2012 11:54:33 -0000 Author: jhb Date: Wed Sep 19 11:54:32 2012 New Revision: 240692 URL: http://svn.freebsd.org/changeset/base/240692 Log: As a followup to r234501, ensure that the native ioctl path always allocates a 4kb buffer if a request uses a buffer size of 0. (The Linux ioctl path already did this.) PR: kern/155658 Submitted by: Andreas Longwitz MFC after: 1 week Modified: head/sys/dev/amr/amr.c Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Wed Sep 19 11:40:17 2012 (r240691) +++ head/sys/dev/amr/amr.c Wed Sep 19 11:54:32 2012 (r240692) @@ -846,11 +846,8 @@ amr_ioctl(struct cdev *dev, u_long cmd, /* handle inbound data buffer */ real_length = amr_ioctl_buffer_length(au_length); + dp = malloc(real_length, M_AMR, M_WAITOK|M_ZERO); if (au_length != 0 && au_cmd[0] != 0x06) { - if ((dp = malloc(real_length, M_AMR, M_WAITOK|M_ZERO)) == NULL) { - error = ENOMEM; - goto out; - } if ((error = copyin(au_buffer, dp, au_length)) != 0) { free(dp, M_AMR); return (error); @@ -920,8 +917,7 @@ amr_ioctl(struct cdev *dev, u_long cmd, error = copyout(dp, au_buffer, au_length); } debug(2, "copyout %ld bytes from %p -> %p", au_length, dp, au_buffer); - if (dp != NULL) - debug(2, "%p status 0x%x", dp, ac->ac_status); + debug(2, "%p status 0x%x", dp, ac->ac_status); *au_statusp = ac->ac_status; out: