nvme-fcloop: verify wwnn and wwpn format
authorDongli Zhang <dongli.zhang@oracle.com>
Tue, 26 May 2020 04:21:18 +0000 (21:21 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 8 Jul 2020 14:16:17 +0000 (16:16 +0200)
commitca8f4beebfb4979acb664e02365ef6e662ef95b0
tree243b384595d73287efe7ba5afd09b44c9f737666
parenta0f0dbaa6986d6777a4a6835ec91616d5c75ac25
nvme-fcloop: verify wwnn and wwpn format

The nvme host and target verify the wwnn and wwpn format via
nvme_fc_parse_traddr(). For instance, it is required that the length of
wwnn to be either 21 ("nn-0x") or 19 (nn-).

Add this verification to nvme-fcloop so that the input should always be in
hex and the length of input should always be 18.

Otherwise, the user may use e.g. 0x2 to create fcloop local port, while
0x0000000000000002 is required for nvme host and target. This makes the
requirement of format confusing.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fcloop.c