]> www.infradead.org Git - users/hch/nvme-cli.git/commit
fabrics: Handle space-padded TRSVCID and TRADDR fields
authorRoland Dreier <roland@purestorage.com>
Thu, 2 Mar 2017 18:06:21 +0000 (10:06 -0800)
committerRoland Dreier <roland@purestorage.com>
Mon, 6 Mar 2017 19:32:06 +0000 (11:32 -0800)
commite48ba33d19ae0e36b66f665bc5260aee922ebfba
treee2a58057c8f72ed20fac4098c2c0ad758f0b383d
parentaedefbeb99737d76cb73c8071a7a27b5ade84b69
fabrics: Handle space-padded TRSVCID and TRADDR fields

The TRSVCID and TRADDR fields in the discovery log page are defined
as ASCII strings, which according to the NVMe standard means they
should be space-padded rather than NUL-terminated.

The current nvme-cli code will print all the spaces and possibly some
garbage from the next field.  For example this causes "connect-all"
to write strings that get rejected with "malformed IP address passed."

Fix this by only writing the contents of these fields until the last
non-space character, and limiting the length to the size of the field.

Signed-off-by: Roland Dreier <roland@purestorage.com>
fabrics.c