lkml.org 
[lkml]   [2018]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/8] NTB: ntb_tool: reading the link file should not end in a NULL byte
    On Fri, Jun 08, 2018 at 06:08:11PM -0600, Logan Gunthorpe <logang@deltatee.com> wrote:
    > When running ntb_test this warning is issued:
    >
    > ./ntb_test.sh: line 200: warning: command substitution: ignored null
    > byte in input
    >

    This is weird. Neither me nor the folks' who tested the script saw this warning.
    I tried it on my laptop with bash and on a target device with busybox-shell. The
    warning never occurred. I even tried a simple command like:
    [[ $(echo -ne "\x4e\x0a\00") == "N" ]] && echo "True"

    It might be that your bash is more modern than mine. Anyway if this patch solves the
    problem you see, that's great. Thanks for it.

    -Sergey

    > This is caused by the kernel returning one more byte than is necessary
    > when reading the link file.
    >
    > Reduce the number of bytes read back to 2 as it was before the
    > commit that regressed this.
    >
    > Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support")
    > Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
    > ---
    > drivers/ntb/test/ntb_tool.c | 3 +--
    > 1 file changed, 1 insertion(+), 2 deletions(-)
    >
    > diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
    > index d592c0ffbd19..ec5cf095cdb9 100644
    > --- a/drivers/ntb/test/ntb_tool.c
    > +++ b/drivers/ntb/test/ntb_tool.c
    > @@ -504,7 +504,7 @@ static ssize_t tool_peer_link_read(struct file *filep, char __user *ubuf,
    > buf[1] = '\n';
    > buf[2] = '\0';
    >
    > - return simple_read_from_buffer(ubuf, size, offp, buf, 3);
    > + return simple_read_from_buffer(ubuf, size, offp, buf, 2);
    > }
    >
    > static TOOL_FOPS_RDWR(tool_peer_link_fops,
    > @@ -1690,4 +1690,3 @@ static void __exit tool_exit(void)
    > debugfs_remove_recursive(tool_dbgfs_topdir);
    > }
    > module_exit(tool_exit);
    > -
    > --
    > 2.11.0
    >

    \
     
     \ /
      Last update: 2018-06-15 21:47    [W:4.962 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site