mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 11:01:06 -04:00
scsi: ibmvfc: Byte swap login_buf.resp values in attribute show functions
Both ibmvfc_show_host_(capabilities|npiv_version) functions retrieve values from vhost->login_buf.resp buffer. This is the MAD response buffer from the VIOS and as such any multi-byte non-string values are in big endian format. Byte swap these values to host CPU endian format for better human readability. Link: https://lore.kernel.org/r/20201117185031.129939-1-tyreld@linux.ibm.com Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
3754cde8df
commit
61bdb4eec8
@@ -3025,7 +3025,7 @@ static ssize_t ibmvfc_show_host_npiv_version(struct device *dev,
|
||||
{
|
||||
struct Scsi_Host *shost = class_to_shost(dev);
|
||||
struct ibmvfc_host *vhost = shost_priv(shost);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", vhost->login_buf->resp.version);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", be32_to_cpu(vhost->login_buf->resp.version));
|
||||
}
|
||||
|
||||
static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
|
||||
@@ -3033,7 +3033,7 @@ static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
|
||||
{
|
||||
struct Scsi_Host *shost = class_to_shost(dev);
|
||||
struct ibmvfc_host *vhost = shost_priv(shost);
|
||||
return snprintf(buf, PAGE_SIZE, "%llx\n", vhost->login_buf->resp.capabilities);
|
||||
return snprintf(buf, PAGE_SIZE, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user