]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: target: consistently null-terminate t10_wwn strings
authorDavid Disseldorp <ddiss@suse.de>
Thu, 7 Mar 2019 22:36:13 +0000 (14:36 -0800)
committerBrian Maly <brian.maly@oracle.com>
Tue, 9 Apr 2019 22:22:11 +0000 (18:22 -0400)
commitd85e31b03db1b914e30d56e991e8a276998f6e67
treee30e1cc38769f0056a348f3ad43af3057fbf0aca
parente0c49dcc65ae4f7605ba9a99278a44c94eb6610f
scsi: target: consistently null-terminate t10_wwn strings

In preparation for supporting user provided vendor strings, add an extra
byte to the vendor, model and revision arrays in struct t10_wwn. This
ensures that the full INQUIRY data can be carried in the arrays along with
a null-terminator.

Change a number of array readers and writers so that they account for
explicit null-termination:

- The pscsi_set_inquiry_info() and emulate_model_alias_store() codepaths
  don't currently explicitly null-terminate; fix this.

- Existing t10_wwn field dumps use for-loops which step over
  null-terminators for right-padding.
  + Use printf with width specifiers instead.

This commit was backported by hand.

Orabug: 29344862

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/target/target_core_device.c
drivers/target/target_core_pscsi.c
drivers/target/target_core_spc.c
drivers/target/target_core_stat.c
include/target/target_core_base.h