Re: [PATCH v2 05/15] NTB: ntb_tool: Add full multi-port NTB API support

From: Logan Gunthorpe
Date: Tue Dec 05 2017 - 14:17:05 EST




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