Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbdLETRC (ORCPT ); Tue, 5 Dec 2017 14:17:02 -0500 Received: from ale.deltatee.com ([207.54.116.67]:52410 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbdLETQ7 (ORCPT ); Tue, 5 Dec 2017 14:16:59 -0500 To: Jon Mason , Serge Semin Cc: Dave Jiang , "Hubbe, Allen" , "S-k, Shyam-sundar" , "Yu, Xiangliang" , Gary R Hook , Sergey.Semin@t-platforms.ru, linux-ntb , linux-kernel References: <20171203191736.3399-1-fancer.lancer@gmail.com> <20171203191736.3399-6-fancer.lancer@gmail.com> From: Logan Gunthorpe Message-ID: Date: Tue, 5 Dec 2017 12:16:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Sergey.Semin@t-platforms.ru, gary.hook@amd.com, Xiangliang.Yu@amd.com, Shyam-sundar.S-k@amd.com, Allen.Hubbe@emc.com, dave.jiang@intel.com, fancer.lancer@gmail.com, jdmason@kudzu.us X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 05/15] NTB: ntb_tool: Add full multi-port NTB API support X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 636 Lines: 19 On 05/12/17 11:03 AM, Jon Mason wrote: >> +static ssize_t tool_fn_read(struct tool_ctx *tc, char __user *ubuf, >> + size_t size, loff_t *offp, >> + u64 (*fn_read)(struct ntb_dev *)) >> { >> size_t buf_size; >> - char *buf; >> - ssize_t pos, rc; >> + char buf[32]; > > I would think you would want the malloc like before, but if not then > make this a #define and reference it as necessary throughout the code. I disagree. Allocating a small 32-byte buf on the stack is a nice cleanup. I'm not sure what you are referring to about the #define. Logan